Sorry for asking a beginners question. I'm quiet familiar with Java, C# ... but I have to write an OpenGL Program in C++ and there is something I don't understand:
I have to parse a text file to get vertices and put them into a vector. So I wrote a method that receives my vector of Vertex objects. It works when I define the method before I call it
std::vector<AESParser::Vertex> vertices;
void parseVertices(std::vector<AESParser::Vertex> &verts){
...
}
...
parseVertices(vertices);
But fails when doing it the other way around. So I understand I have to declare it in the header file. So I wrote something like this:
*** Header ***
class AESParser
{
public:
struct Vertex{
float x;
float y;
float z;
};
AESParser();
virtual ~AESParser();
void read();
protected:
private:
int readNumVertices(std::fstream &stream);
int readNumFaces(std::fstream &stream);
void parseVertices(std::vector<Vertex> &verts);
Vertex readVertex(std::fstream &stream);
};
I know there are probably many more mistakes since I never did C++ but the main problem with this is, that I get the following error message:
undefined reference to `AESParser::parseVertices(std::vector<AESParser::Vertex, std::allocator<AESParser::Vertex> >&)'
So something seems to be wrong with the "parseVertices()" method and I don't see what. It works for the others like "readNumVertices()".
Thanks for your help!