Opengl - shader problem

Started by
8 comments, last by Brother Bob 12 years ago
I'm trying to mimic the shader used in opengl.org website http://www.opengl.or...rs/lighting.php , but i only got so far as declaring the following object:

cwc::glShaderManager SM;


when i got these errors:

error LNK2001: unresolved external symbol "public: __thiscall cwc::glShaderManager::glShaderManager(void)" 0glShaderManager@cwc@@QAE@XZ"]??0glShaderManager@cwc@@QAE@XZ)
error LNK2001: unresolved external symbol "public: virtual __thiscall cwc::glShaderManager::~glShaderManager(void)" 1glShaderManager@cwc@@UAE@XZ"]1glShaderManager@cwc@@UAE@XZ)


I included all the necessary includes exactly the same as the project on the website has it. I don't know why im getting linker errors when i never added any shader linkers, and this is because the project on the website didnt have any shader linkers.

My linkers are this:

SOIL.lib
opengl32.lib
glu32.lib
glut32.lib


How can i solve these errors?
Advertisement
Sounds like, linker can't find implementation of these (glShaderManager constructor&destructor) functions.
I checked the following link. I found them on "archive:cwc\source\glsl.cpp"
Are you sure that you included this file to your project?

Best wishes, FXACE.
I belive i did it correctly because i mimic'd the example by doing the following:

c/c++ -> additional include directories->
- glew/include
- cwc/include
- freeglut/include

And with my project folder looking like this:

35d6kud.jpg
But did you add the file FXACE mentioned in your project? You have probably included the files because your code compiles just fine so the include paths and such are just fine, but the linker cannot assemble the final program because it cannot find the actual code for the functions anywhere.
Sorry, i should'uv mentioned in my previous post that glsl.cpp is located in the cwc folder(cwc/source) you see in the picture, and since that folder is an include i cant see why its giving me errors.

*Note: The cwc folder is broken down into two seperate folders "include" and "source", the include folder has header(.h) and source folder has the implementation(.cpp)
But is the file added to your project? It's not enough that the file itself is located in the folder, it has to be in the project as well or the compiler won't compile it.
This is what my project currently looks like:
t5ir83.jpg

And if i add the existing "glsl.cpp" file from the cwc folder of my project and add it into my project, like you mentioned, then my compiler brings up 78 unresolved linker errors
That means you have other files missing in the project as well. If you want to use the code in glsl.cpp, then you have to add it to the project, and you also have to add whatever code it requires.
But i can use glut and opengl function fine without adding them to my project. It's just adding glsl is giving me all trouble =S and like what i said above when i add it i get 78 glew errors. And when i add the 3 folders to my project, tons of errors complaining of duplicates
OpenGL and GLUT are automatically linked when you include the GLUT header. If you open the GLUT header file, you will see some code in there that automatically adds the correct library files to the linker (some #pragma-directives in the beginning of the header file if I remember correct).

If you're getting linker errors related to GLEW, then you simply need to add those files to the project as well.

This topic is closed to new replies.

Advertisement