Jump to content
  • Advertisement
Sign in to follow this  
Mariusz Pilipczuk

OpenGL OpenGL shaders in Windows

This topic is 2155 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

Hello,

 

I was recently trying to compile my game engine on Windows, but I ran into a serious problem. I am using SDL and OpenGL, and I link with the following options:

 

-lmingw32 -lSDLmain -lSDL -lopengl32 -lglu32
 

I use the Code::Blocks IDE. When I compile the engine, I get the following errors:

 

obj\Debug\specfx\specfx.o||In function `meCreateEffect':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|61|undefined reference to `glCreateProgram@0'|
obj\Debug\specfx\specfx.o||In function `meAttachShaderFromMemory':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|97|undefined reference to `glCreateShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|98|undefined reference to `glCreateShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|99|undefined reference to `glShaderSource@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|100|undefined reference to `glCompileShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|102|undefined reference to `glGetShaderiv@12'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|106|undefined reference to `glGetShaderiv@12'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|108|undefined reference to `glGetShaderInfoLog@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|122|undefined reference to `glAttachShader@8'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|138|undefined reference to `glCreateShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|140|undefined reference to `glShaderSource@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|141|undefined reference to `glCompileShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|143|undefined reference to `glGetShaderiv@12'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|147|undefined reference to `glGetShaderiv@12'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|149|undefined reference to `glGetShaderInfoLog@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|162|undefined reference to `glAttachShader@8'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|172|undefined reference to `glCreateShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|174|undefined reference to `glShaderSource@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|175|undefined reference to `glCompileShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|177|undefined reference to `glGetShaderiv@12'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|181|undefined reference to `glGetShaderiv@12'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|183|undefined reference to `glGetShaderInfoLog@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|196|undefined reference to `glAttachShader@8'|
obj\Debug\specfx\specfx.o||In function `meLinkShaders':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|210|undefined reference to `glLinkProgram@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|212|undefined reference to `glGetProgramiv@12'|
obj\Debug\specfx\specfx.o||In function `meApplyEffect':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|228|undefined reference to `glUseProgram@4'|
obj\Debug\specfx\specfx.o||In function `meDeleteEffect':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\specfx\specfx.c|266|undefined reference to `glDeleteProgram@4'|
obj\Debug\video\shader.o||In function `me_init_shader':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|69|undefined reference to `glCreateShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|70|undefined reference to `glShaderSource@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|71|undefined reference to `glCompileShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|73|undefined reference to `glCreateShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|74|undefined reference to `glShaderSource@16'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|75|undefined reference to `glCompileShader@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|77|undefined reference to `glCreateProgram@0'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|78|undefined reference to `glAttachShader@8'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|79|undefined reference to `glAttachShader@8'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|80|undefined reference to `glLinkProgram@4'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|81|undefined reference to `glUseProgram@4'|
obj\Debug\video\shader.o||In function `meSaveShaderInfoLog':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|101|undefined reference to `glGetProgramiv@12'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|105|undefined reference to `glGetProgramInfoLog@16'|
obj\Debug\video\shader.o||In function `me_shader_variablei':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|126|undefined reference to `glGetUniformLocation@8'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|127|undefined reference to `glUniform1i@8'|
obj\Debug\video\shader.o||In function `me_shader_variabled':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|140|undefined reference to `glGetUniformLocation@8'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|141|undefined reference to `glUniform1d'|
obj\Debug\video\shader.o||In function `me_shader_variablef':|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|154|undefined reference to `glGetUniformLocation@8'|
C:\Age of Prisoners stuff\Madd Engine (ME)\me-1.0.0\video\shader.c|155|undefined reference to `glUniform1f@8'|
||=== Build finished: 46 errors, 0 warnings ===|

Which looks like the shader API is not there :(.

 

Has anyone ran into this problem? Do you know how to solve it?

 

All help is appreciated.

Share this post


Link to post
Share on other sites
Advertisement

But this appears to be a linker error. Am I supposed to link with another library? If so, what library is it? Also, I believe SDL loads the functions for me, and even if it didn't, it wouldn't be a LINKER error, just a runtime error.

Share this post


Link to post
Share on other sites

If you're using GL 2 headers, which you most likely are, you need to load shaders, fbos, etc. as extensions.

It is recommended to do this with a library. GLEW and GLEE are the two major ones.

-G

Share this post


Link to post
Share on other sites

Is it still OK if I use SDL though? Because SDL does all the initialising for me, and on Linux it was enough to get the shaders working. And if it's possible, can anyone give na example?

Share this post


Link to post
Share on other sites

Of course you can still use SDL. The two libraries mentioned above do not compete with SDL and can perfectly well be used together.

Share this post


Link to post
Share on other sites
Is it still OK if I use SDL though? Because SDL does all the initialising for me, and on Linux it was enough to get the shaders working. And if it's possible, can anyone give na example?
It doesn't work the same on Linux.

The OpenGL library that ships with Windows is OpenGL 1.1. All the newer functionality is provided by the driver for your GPU and supplied by the IHV. So you need to supply yourself with a newer version of GL.H, and manually create function pointers to anything newer than 1.1. That's what GLEW or GLEE are for.

Share this post


Link to post
Share on other sites
Does -lglu32 not need to go before -lopengl32?

I remember running into something like this but it might have been with glut.

Also try linking -lglew32 (before -lopengl32 and -lglu32). Glew can be a little tricky to compile up in mingw, but it is possible. Edited by Karsten_

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!