SFML community forums
Help => General => Topic started by: Lolilolight on February 27, 2014, 08:48:36 pm
-
I, I'm trying to use glew in a library using SFML to add the 3D but, it doesn't seems to work.
I have those errors when I want to use my library : (And it happens since I'm using tdm-gcc, but when I link only opengl there isn't any link errors.)
C:\ODFAEG\lib\libsfgl-graphics-s.a(renderTarget.cpp.obj):renderTarget.cpp|| undefined reference to `_imp____GLEW_EXT_blend_func_separate'|
C:\ODFAEG\lib\libsfgl-graphics-s.a(renderTarget.cpp.obj):renderTarget.cpp|| undefined reference to `_imp____glewBlendFuncSeparateEXT'|
C:\ODFAEG\lib\libsfgl-graphics-s.a(renderTarget.cpp.obj):renderTarget.cpp|| undefined reference to `_imp____GLEW_EXT_blend_func_separate'|
C:\ODFAEG\lib\libsfgl-graphics-s.a(renderTarget.cpp.obj):renderTarget.cpp|| undefined reference to `_imp____glewBlendFuncSeparateEXT'|
C:\ODFAEG\lib\libsfgl-graphics-s.a(renderTarget.cpp.obj):renderTarget.cpp|| undefined reference to `_imp____glewBlendFuncSeparateEXT'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|
It seems it doesn't find the glew libs in my lib using SFML, it compile well when I compile my library but it fails when I want to use it.
-
Since your library is static, it doesn't "include" or link any 3rd-party dependency (unless you use the ugly trick that SFML used before), so you have to link every dependency of your library into the final app.
If you're creating static libraries with dependencies, you should read more about what static libraries are and how they work. Knowing this helps to solve this kind of problems.
-
I've linked glew in my final project :
I've linked the file libglew32.a and I've defined the GLEW_STATIC macro but it doesn't solve the problem.
I think I'll have to compile this dynamically...
-
I've defined the GLEW_STATIC macro
You probably did it wrong, since the linker is looking for imported functions (the "_imp____" prefix).
-
Yes it seems that I did somethings wrong then, I'll check. ^^
-
Ok it seems that code blocks always check for the dynamic glew library. (It's certainly because of the cmake files config)
So to don't wast time I've compiled glew dynamically, linked it to the project and it works :
-
Arf, I had simply to add this line in the CMAKE file :
add_definitions(-DGLEW_STATIC)