Jump to content

  • Log In with Google      Sign In   
  • Create Account


Opengl - shader problem


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Shawn619   Members   -  Reputation: 342

Like
0Likes
Like

Posted 24 March 2012 - 03:15 AM

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?

Sponsor:

#2 FXACE   Members   -  Reputation: 182

Like
1Likes
Like

Posted 24 March 2012 - 07:34 AM

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.

#3 Shawn619   Members   -  Reputation: 342

Like
0Likes
Like

Posted 24 March 2012 - 09:17 AM

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:

Posted Image

#4 Brother Bob   Moderators   -  Reputation: 7746

Like
1Likes
Like

Posted 24 March 2012 - 09:30 AM

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.

#5 Shawn619   Members   -  Reputation: 342

Like
0Likes
Like

Posted 24 March 2012 - 10:03 AM

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)

#6 Brother Bob   Moderators   -  Reputation: 7746

Like
0Likes
Like

Posted 24 March 2012 - 10:07 AM

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.

#7 Shawn619   Members   -  Reputation: 342

Like
0Likes
Like

Posted 24 March 2012 - 10:37 AM

This is what my project currently looks like:
Posted Image

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

#8 Brother Bob   Moderators   -  Reputation: 7746

Like
0Likes
Like

Posted 24 March 2012 - 10:53 AM

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.

#9 Shawn619   Members   -  Reputation: 342

Like
0Likes
Like

Posted 24 March 2012 - 11:12 AM

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

#10 Brother Bob   Moderators   -  Reputation: 7746

Like
0Likes
Like

Posted 24 March 2012 - 11:27 AM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS