Hey guys, i keep getting this error, it displays
Undefined Reference to ‘BackgroundSystem::draw()’
now im working on a project with 4 other people, so we are using it to “pull” and “push”, now when i add a new source file (BackgroundSystem.cpp) i have to add it to the makefile manually, so i do, but when i go to compile it just prints out undefined reference, i have checked the header files and source files way to many times for me to remember, and i cant see anything wrong,
does anyone have any idea on why this is happening?
The error is from the linker, not the compiler.
Your header declares a member function draw() in class BackgroundSystem. The compiler will be happy to generate calls to that member function in the assumption that at link time one of the .o files (or libraries) in the link will provide that function. None does, so you get an undefined reference error.
Have you defined BackgroundSystem::draw() in your .cpp, i.e. have you written that function’s body?
Your question is for general coding rather than OpenGL.
But to answer your question, this looks like a linker error.
Check that the name of function is correct.
Also look at the declaration. The error is due to the linker not getting access to the function definition.
Inspect the path settings - the lib and include files.