Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Problem with glew.  (Read 1800 times)

0 Members and 1 Guest are viewing this topic.

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Problem with glew.
« 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.)

Code: [Select]
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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Problem with glew.
« Reply #1 on: February 27, 2014, 11:03:57 pm »
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.
Laurent Gomila - SFML developer

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Problem with glew.
« Reply #2 on: February 28, 2014, 11:16:26 am »
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...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Problem with glew.
« Reply #3 on: February 28, 2014, 01:53:57 pm »
Quote
I've defined the GLEW_STATIC macro
You probably did it wrong, since the linker is looking for imported functions (the "_imp____" prefix).
Laurent Gomila - SFML developer

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Problem with glew.
« Reply #4 on: February 28, 2014, 01:56:31 pm »
Yes it seems that I did somethings wrong then, I'll check. ^^

Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Problem with glew.
« Reply #5 on: March 02, 2014, 04:04:46 pm »
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 :


Lolilolight

  • Hero Member
  • *****
  • Posts: 1232
    • View Profile
Re: Problem with glew.
« Reply #6 on: March 03, 2014, 01:42:30 pm »
Arf, I had simply to add this line in the CMAKE file :

add_definitions(-DGLEW_STATIC)