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

Author Topic: SFML 2.2 and GLEW  (Read 8183 times)

0 Members and 2 Guests are viewing this topic.

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
SFML 2.2 and GLEW
« on: February 07, 2015, 08:56:53 pm »
Hi! Can't connect the glew library to the project, the studio gives error that the functions already defined or there are any conflicts.
Quote from tutorial: http://www.sfml-dev.org/tutorials/2.2/window-opengl.php
Quote
People sometimes think that SFML automatically includes GLEW (a library which manages OpenGL extensions) because SFML uses GLEW internally, but it's only an implementation detail. From the user's point of view, GLEW must be handled like any other external library.
Please explain in detail how to connect glew to sfml 2.2?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.2 and GLEW
« Reply #1 on: February 07, 2015, 10:14:00 pm »
Quote
Please explain in detail how to connect glew to sfml 2.2?
Wrong question ;)

Show your errors so that we can solve your specific problem.
Laurent Gomila - SFML developer

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.2 and GLEW
« Reply #2 on: February 08, 2015, 07:37:37 pm »
Can't linking glew and sfml statically, the studio gives error that the glew functions already defined.
(click to show/hide)
« Last Edit: February 08, 2015, 07:49:16 pm by GLS »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.2 and GLEW
« Reply #3 on: February 08, 2015, 11:20:13 pm »
Static SFML 2.2 doesn't embed its dependencies anymore, so if GLEW is linked twice, it's in your project settings.
Laurent Gomila - SFML developer

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.2 and GLEW
« Reply #4 on: February 09, 2015, 07:31:31 am »
My project settings (visual c++ 2010):
C/C++ / General / Additional Include Directories:
Quote
C:\Dev\glew-1.12.0\include;
C:\Dev\glm;
C:\Dev\SFML-2.2\include
Linker / General / Additional Library Directories:
Quote
C:\Dev\SFML-2.2\lib;
C:\Dev\glew-1.12.0\lib\Release\Win32
C/C++ / Preprocessor / Preprocessor Definitions:
Quote
SFML_STATIC;GLEW_STATIC;WIN32;NDEBUG;_CONSOLE
Linker » Input » Additional Dependencies:
Quote
glew.lib;
glew32s.lib;
winmm.lib;
freetype.lib;
jpeg.lib;
opengl32.lib;
sfml-graphics-s.lib;
sfml-window-s.lib;
sfml-system-s.lib;
%(AdditionalDependencies)
Errors:
Quote
1>glew.lib(glew.obj) : error LNK2005: ___glewCopyTexSubImage3D уже определен в glew32s.lib(glew.obj)
1>glew.lib(glew.obj) : error LNK2005: ___glewDrawRangeElements уже определен в glew32s.lib(glew.obj)
1>glew.lib(glew.obj) : error LNK2005: ___glewTexImage3D уже определен в glew32s.lib(glew.obj)
1>glew.lib(glew.obj) : error LNK2005: ___glewTexSubImage3D уже определен в glew32s.lib(glew.obj)
1>glew.lib(glew.obj) : error LNK2005: ___glewActiveTexture уже определен в glew32s.lib(glew.obj)
...


If Linker » Input » Additional Dependencies:
Quote
glew32s.lib;
winmm.lib;
freetype.lib;
jpeg.lib;
opengl32.lib;
sfml-graphics-s.lib;
sfml-window-s.lib;
sfml-system-s.lib;
%(AdditionalDependencies)
Errors:
Quote
1>LINK : warning LNK4098: библиотека по умолчанию "LIBCMT" противоречит использованию других библиотек; используйте параметр /NODEFAULTLIB:library
1>sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2001: неразрешенный внешний символ "_glewGetErrorString"
1>sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2001: неразрешенный внешний символ "_glewInit"


If Linker » Input » Additional Dependencies:
Quote
glew.lib;
winmm.lib;
freetype.lib;
jpeg.lib;
opengl32.lib;
sfml-graphics-s.lib;
sfml-window-s.lib;
sfml-system-s.lib;
%(AdditionalDependencies)
Errors:
Quote
1>main.obj : error LNK2001: неразрешенный внешний символ "_glewInit@0"
« Last Edit: February 09, 2015, 07:40:35 am by GLS »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.2 and GLEW
« Reply #5 on: February 09, 2015, 07:55:36 am »
Quote
1>LINK : warning LNK4098: библиотека по умолчанию "LIBCMT" противоречит использованию других библиотек; используйте параметр /NODEFAULTLIB:library
1>sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2001: неразрешенный внешний символ "_glewGetErrorString"
1>sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2001: неразрешенный внешний символ "_glewInit"
Quote
1>main.obj : error LNK2001: неразрешенный внешний символ "_glewInit@0"
Seriously?
Laurent Gomila - SFML developer

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.2 and GLEW
« Reply #6 on: February 09, 2015, 08:00:20 am »
Seriously?
Sorry, I don't understand the question?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.2 and GLEW
« Reply #7 on: February 09, 2015, 08:42:34 am »
I don't understand the error messages...
Laurent Gomila - SFML developer

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.2 and GLEW
« Reply #8 on: February 09, 2015, 10:58:59 am »
I don't understand the error messages...
Sorry, my visual studio only in russian language
Quote
1>LINK : warning LNK4098: defaultlib "LIBCMT" conflicts with use of other libs; use /NODEFAULTLIB:library
1>sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2001: unresolved external symbol "_glewGetErrorString"
1>sfml-graphics-s.lib(GLExtensions.cpp.obj) : error LNK2001: unresolved external symbol "_glewInit"
Quote
1>main.obj : error LNK2001: unresolved external symbol "_glewInit@0"
« Last Edit: February 09, 2015, 11:07:26 am by GLS »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.2 and GLEW
« Reply #9 on: February 09, 2015, 11:16:51 am »
Thanks.

SFML depends on a statically linked GLEW, so you need to link (only) glew32s.lib and define the GLEW_STATIC preprocessor symbol.

Now I have no idea why you still have unresolved symbols with this configuration. It should work fine.
Laurent Gomila - SFML developer

GLS

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: SFML 2.2 and GLEW
« Reply #10 on: February 09, 2015, 11:26:09 am »
may be I need to use another version of glew?
current version 1.12.0

maly

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: SFML 2.2 and GLEW
« Reply #11 on: February 09, 2015, 12:27:44 pm »
You need to recompile SFML with your version of glew.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.2 and GLEW
« Reply #12 on: February 09, 2015, 01:11:13 pm »
Quote
may be I need to use another version of glew?
No, it should work.

Quote
You need to recompile SFML with your version of glew.
No...
Laurent Gomila - SFML developer

maly

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: SFML 2.2 and GLEW
« Reply #13 on: February 09, 2015, 02:01:36 pm »
Quote
Quote
You need to recompile SFML with your version of glew.
No...

Interesting, because without recompiling I have the same errors.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: SFML 2.2 and GLEW
« Reply #14 on: February 09, 2015, 02:16:31 pm »
Quote
Interesting, because without recompiling I have the same errors.
Which compiler do you use?
Laurent Gomila - SFML developer