Jump to content
  • Advertisement
Sign in to follow this  
Shawn619

OpenGL Opengl - shader problem

This topic is 2404 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!