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

Author Topic: Trouble linking SFML2  (Read 4283 times)

0 Members and 1 Guest are viewing this topic.

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Trouble linking SFML2
« on: March 10, 2011, 10:39:04 pm »
I'm compiling a simple program on Linux to open a window, but I'm getting linker errors in Render.cpp

Code: [Select]

Linking console executable: bin/Debug/RenderingTests
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::Initialize()':
Renderer.cpp:(.text+0xda): undefined reference to `glDisable'
Renderer.cpp:(.text+0xe4): undefined reference to `glDisable'
Renderer.cpp:(.text+0xee): undefined reference to `glEnable'
Renderer.cpp:(.text+0xf8): undefined reference to `glEnable'
Renderer.cpp:(.text+0x105): undefined reference to `glAlphaFunc'
Renderer.cpp:(.text+0x10f): undefined reference to `glMatrixMode'
Renderer.cpp:(.text+0x114): undefined reference to `glLoadIdentity'
Renderer.cpp:(.text+0x11e): undefined reference to `glMatrixMode'
Renderer.cpp:(.text+0x123): undefined reference to `glLoadIdentity'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SaveGLStates()':
Renderer.cpp:(.text+0x15a): undefined reference to `glPushAttrib'
Renderer.cpp:(.text+0x164): undefined reference to `glMatrixMode'
Renderer.cpp:(.text+0x169): undefined reference to `glPushMatrix'
Renderer.cpp:(.text+0x173): undefined reference to `glMatrixMode'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::RestoreGLStates()':
Renderer.cpp:(.text+0x185): undefined reference to `glPopAttrib'
Renderer.cpp:(.text+0x18f): undefined reference to `glMatrixMode'
Renderer.cpp:(.text+0x194): undefined reference to `glPopMatrix'
Renderer.cpp:(.text+0x19e): undefined reference to `glMatrixMode'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::Clear(sf::Color const&)':
Renderer.cpp:(.text+0x1ec): undefined reference to `glClearColor'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SetProjection(sf::Matrix3 const&)':
Renderer.cpp:(.text+0x4aa): undefined reference to `glMatrixMode'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SetViewport(sf::Rect<int> const&)':
Renderer.cpp:(.text+0x5c2): undefined reference to `glViewport'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SetBlendMode(sf::Blend::Mode)':
Renderer.cpp:(.text+0x64a): undefined reference to `glEnable'
Renderer.cpp:(.text+0x65e): undefined reference to `__GLEW_EXT_blend_func_separate'
Renderer.cpp:(.text+0x67f): undefined reference to `__glewBlendFuncSeparateEXT'
Renderer.cpp:(.text+0x693): undefined reference to `glBlendFunc'
Renderer.cpp:(.text+0x6d6): undefined reference to `glDisable'
Renderer.cpp:(.text+0x6e8): undefined reference to `glBlendFunc'
Renderer.cpp:(.text+0x6fb): undefined reference to `glBlendFunc'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SetTexture(sf::Image const*)':
Renderer.cpp:(.text+0x7a8): undefined reference to `glBindTexture'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SetShader(sf::Shader const*)':
Renderer.cpp:(.text+0x844): undefined reference to `__glewUseProgramObjectARB'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::AddVertex(float, float)':
Renderer.cpp:(.text+0x91c): undefined reference to `glColor4f'
Renderer.cpp:(.text+0x927): undefined reference to `glTexCoord2f'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::AddVertex(float, float, float, float)':
Renderer.cpp:(.text+0x9b8): undefined reference to `glColor4f'
Renderer.cpp:(.text+0x9c9): undefined reference to `glTexCoord2f'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::AddVertex(float, float, sf::Color const&)':
Renderer.cpp:(.text+0xa83): undefined reference to `glColor4f'
Renderer.cpp:(.text+0xa8e): undefined reference to `glTexCoord2f'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::AddVertex(float, float, float, float, sf::Color const&)':
Renderer.cpp:(.text+0xb4f): undefined reference to `glColor4f'
Renderer.cpp:(.text+0xb60): undefined reference to `glTexCoord2f'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::ProcessVertex(float, float, float, float, float, float, float, float)':
Renderer.cpp:(.text+0xc02): undefined reference to `glColor4f'
Renderer.cpp:(.text+0xc13): undefined reference to `glTexCoord2f'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SaveGLStates()':
Renderer.cpp:(.text+0x17c): undefined reference to `glPushMatrix'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::RestoreGLStates()':
Renderer.cpp:(.text+0x1a7): undefined reference to `glPopMatrix'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::Clear(sf::Color const&)':
Renderer.cpp:(.text+0x1fa): undefined reference to `glClear'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::SetProjection(sf::Matrix3 const&)':
Renderer.cpp:(.text+0x4b3): undefined reference to `glLoadMatrixf'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::Begin(sf::Renderer::PrimitiveType)':
Renderer.cpp:(.text+0x86e): undefined reference to `glBegin'
Renderer.cpp:(.text+0x87e): undefined reference to `glBegin'
Renderer.cpp:(.text+0x88e): undefined reference to `glBegin'
Renderer.cpp:(.text+0x8a6): undefined reference to `glBegin'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::End()':
Renderer.cpp:(.text+0x8b1): undefined reference to `glEnd'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::AddVertex(float, float)':
Renderer.cpp:(.text+0x941): undefined reference to `glVertex2f'
//usr/local/lib/libsfml-graphics-s.a(Renderer.cpp.o): In function `sf::Renderer::AddVertex(float, float, float, float)':
Renderer.cpp:(.text+0x9e3): undefined reference to `glVertex2f'


Could somebody shed some light on this?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Trouble linking SFML2
« Reply #1 on: March 10, 2011, 11:44:55 pm »
You must link to OpenGL (-lGL).
Laurent Gomila - SFML developer

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Trouble linking SFML2
« Reply #2 on: March 10, 2011, 11:59:20 pm »
Thanks - maybe that should be more explicit in the tutorial?

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Trouble linking SFML2
« Reply #3 on: March 11, 2011, 12:16:41 am »
Some more linker errors required linking with jpeg, GLEW, and Xrandr.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Trouble linking SFML2
« Reply #4 on: March 11, 2011, 07:58:08 am »
You're not supposed to use static libraries on Linux. If you do, you'll have to link to all the SFML's external dependencies; there's no link step when building static libraries, so all the dependencies must be given to the linker when building your final application.

And yes, this point will be explained in the future tutorial ;)
Laurent Gomila - SFML developer

RobotGymnast

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Trouble linking SFML2
« Reply #5 on: March 11, 2011, 12:51:04 pm »
I tried it with shared libraries, and got linker errors as a result. For some reason, it's working now, though. Thanks.

 

anything