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

Author Topic: Undefined reference when creating a window  (Read 2602 times)

0 Members and 1 Guest are viewing this topic.

topiser

  • Newbie
  • *
  • Posts: 2
    • View Profile
Undefined reference when creating a window
« on: September 01, 2010, 04:25:31 am »
After setting up sfml to work in linux, i moved on to the Opening A Window tutorial. When creating the main window using sf::Window, i got and error that I can't seem to overcome.

Code: [Select]
bob.cpp:(.text+0xe4): undefined reference to `sf::Window::Window(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, sf::ContextSettings const&)'

I checked my code a few times, copy and pasted the code just to make sure, so i'm sure its not anything I've mistyped. I also have my IDE build with "-lsfml-window -lsfml-system" so I assume i didn't screw up there either.

I'm pretty sure it's something simple i overlooked, so if you can give me any advice I'd appriciate it :D

Lupinius

  • Jr. Member
  • **
  • Posts: 85
    • View Profile
Undefined reference when creating a window
« Reply #1 on: September 01, 2010, 03:46:17 pm »
Does the same thing happen when you compile from the terminal? If not, it's an IDE related problem.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Undefined reference when creating a window
« Reply #2 on: September 01, 2010, 04:12:02 pm »
The SFML 2 libraries are now named "sfml2-xxx". You should remove all the previous binaries (SFML 1, old SFML 2) to avoid this kind of confusion.

PS: next time, please don't forget to tell us that you're using SFML 2... ;)
Laurent Gomila - SFML developer

topiser

  • Newbie
  • *
  • Posts: 2
    • View Profile
Undefined reference when creating a window
« Reply #3 on: September 01, 2010, 10:15:59 pm »
Thanks for the advice, but it still doesn't work. I cleaned my system of all SFML versions, then using make, reinstalled SFML2. I tried putting the libraries as sfml2-xxx, but it didn't recognize them. It does recognize them as lsfml-xxx, so i'm not sure why its still like that. If i do use lsfml-xxx though it still gets the same error as before.

Edit: Nevermind, i got it to work. I'm using Geany IDE, which lets you set commands to buttons to make compiling a lot faster, and i forgot i had put in 3 libraries, but the box was too short and only showed 2, so every time i only changed the first 2 library names, and left the last one as lsfml-xxx.

Thanks for all your help :D I'm happy i can now start doing some game programming in linux. Pretty much don't need windows anymore :D