Brent
Brent

Reputation: 61

Error: Expected constructor, destructor, or type conversion before '<' token

I have been trying for the last 20 minutes figuring out why it is throwing this error..

#include <GL/glut.h>
#include <vector>

// global width and height
int GW;
int GH;

// current mouse position in pixel coordinate
int x;
int y;

typedef struct myTriangle {
   float tx;
   float ty;
} myTriangle;

vector<myTriangle> container;

The code throws this:

Transform.cpp:17: error: expected constructor, destructor, or type conversion before '<' token

Upvotes: 1

Views: 1171

Answers (2)

JeffW
JeffW

Reputation: 351

Looks to me like you haven't specified the vector's namespace and haven't declared that you are using std::vector. Try this instead:

std::vector<myTriangle> container;

Upvotes: 5

Mark Ransom
Mark Ransom

Reputation: 308206

Maybe it needs to be std::vector?

Upvotes: 1

Related Questions