Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.