Vector usage? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Vector usage?

SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
A while back, Adrian showed me the vector class and gave a brief explanation of how to use it, but I can't get it working to save my life, and my help files explain what it does a billion different ways but not once do they show you how to use the dang thing. Here is what I am currently doing:
[code]
//3d.h
#include

typedef struct
{
float x, y, z;
float sx, sy;
} VERTEX;

typedef struct
{
int num_vertex, color;
char texture[256];
vector vert;
} POLYGON;
[/code]
Now when i try compiling this, it gives me this error:
"Type Name Expected"
What else should I do or what should I not do here? Thanks for any help in advance.

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]

Comments

  • AmanteAmante Posts: 52Member
    Change the line before the last one to:
    std::vector vert;

    or even better add the line:
    using namespace std;
    just after the include line.

    It's for using the STL namespace.

    Don.


    : A while back, Adrian showed me the vector class and gave a brief explanation of how to use it, but I can't get it working to save my life, and my help files explain what it does a billion different ways but not once do they show you how to use the dang thing. Here is what I am currently doing:
    : [code]
    : //3d.h
    : #include
    :
    : typedef struct
    : {
    : float x, y, z;
    : float sx, sy;
    : } VERTEX;
    :
    : typedef struct
    : {
    : int num_vertex, color;
    : char texture[256];
    : vector vert;
    : } POLYGON;
    : [/code]
    : Now when i try compiling this, it gives me this error:
    : "Type Name Expected"
    : What else should I do or what should I not do here? Thanks for any help in advance.
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]
    :


  • SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
    You know, now my program compiles, but a get a nice slew of warnings from vector.h, haha! Mostly "Warning: Comparing signed and unsigned values!". Fortuneatly, my code produces no warnings what so ever.


    -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red]


Sign In or Register to comment.