Afternoon,
Unfortunately, I am having some problems with C++ and OpenGL that I have been trying to sort for the last few hours. I have to book "Beginning OpenGL Game Programming Second Edition" and I have completed a couple of exercises from it and they have compiled fine with G++ on Arch Linux.
However, I am now trying to compile a main.cpp file which includes headers called glxwindow.h and example.h. Each of the header files has its own .cpp file within which are the functions (Which have been prototyped in the headers). I am getting an error when trying to access functions within the classes defined in example.h and glxwindow.h.
This raises an error upon compiling with G++:
I stripped out all of the code from the main.cpp aside from the including of the header files and the main function, which instantiates a class and then calls a function from it- still no luck.
So I am stuck as to where to go from here, main.cpp includes header files, each with their own .cpp file, and tries to access functions from them, but it doesn't work.
Any help would be great.
Unfortunately, I am having some problems with C++ and OpenGL that I have been trying to sort for the last few hours. I have to book "Beginning OpenGL Game Programming Second Edition" and I have completed a couple of exercises from it and they have compiled fine with G++ on Arch Linux.
However, I am now trying to compile a main.cpp file which includes headers called glxwindow.h and example.h. Each of the header files has its own .cpp file within which are the functions (Which have been prototyped in the headers). I am getting an error when trying to access functions within the classes defined in example.h and glxwindow.h.
Code:
// I have excluded the rest of the main.cpp file for brevity
Example example; // Creating an instance of the class
example.init();
This raises an error upon compiling with G++:
Code:
main.cpp:(.text+0xb2): undefined reference to `Example::init()'
I stripped out all of the code from the main.cpp aside from the including of the header files and the main function, which instantiates a class and then calls a function from it- still no luck.
So I am stuck as to where to go from here, main.cpp includes header files, each with their own .cpp file, and tries to access functions from them, but it doesn't work.
Any help would be great.