You are not logged in.
Pages: 1
Hi there, I'm not sure if this is the right place to post this, but:
I installed SFML from the community repository:
community/sfml 1.99.git20120312-1 [installed]
A simple, fast, cross-platform, and object-oriented multimedia API
And I have the proper shared object files:
▕ lrwxrwxrwx▏3 hour│ 18B│libsfml-audio.so => libsfml-audio.so.2
▕ lrwxrwxrwx▏3 hour│ 20B│libsfml-audio.so.2 => libsfml-audio.so.2.0
▕ -rwxr-xr-x▏3 hour│ 64K│libsfml-audio.so.2.0
▕ lrwxrwxrwx▏3 hour│ 21B│libsfml-graphics.so => libsfml-graphics.so.2
▕ lrwxrwxrwx▏3 hour│ 23B│libsfml-graphics.so.2 => libsfml-graphics.so.2.0
▕ -rwxr-xr-x▏3 hour│ 589K│libsfml-graphics.so.2.0
▕ lrwxrwxrwx▏3 hour│ 20B│libsfml-network.so => libsfml-network.so.2
▕ lrwxrwxrwx▏3 hour│ 22B│libsfml-network.so.2 => libsfml-network.so.2.0
▕ -rwxr-xr-x▏3 hour│ 108K│libsfml-network.so.2.0
▕ lrwxrwxrwx▏3 hour│ 19B│libsfml-system.so => libsfml-system.so.2
▕ lrwxrwxrwx▏3 hour│ 21B│libsfml-system.so.2 => libsfml-system.so.2.0
▕ -rwxr-xr-x▏3 hour│ 39K│libsfml-system.so.2.0
▕ lrwxrwxrwx▏3 hour│ 19B│libsfml-window.so => libsfml-window.so.2
▕ lrwxrwxrwx▏3 hour│ 21B│libsfml-window.so.2 => libsfml-window.so.2.0
▕ -rwxr-xr-x▏3 hour│ 80K│libsfml-window.so.2.0
But when I try to compile a simple example (without linking):
[~/workspace/zombeh/src]$ g++ main.cpp []
/tmp/ccAzHcgf.o: In function `main':
main.cpp:(.text+0x6c): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
main.cpp:(.text+0x93): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, sf::WindowSettings const&)'
main.cpp:(.text+0xbf): undefined reference to `sf::RenderWindow::~RenderWindow()'
main.cpp:(.text+0xf3): undefined reference to `sf::RenderWindow::~RenderWindow()'
collect2: ld returned 1 exit status
And with linking:
[~/workspace/zombeh/src]$ g++ main.cpp -lsfml-graphics -lsfml-window -lsfml-system []
/tmp/cckWyWRM.o: In function `main':
main.cpp:(.text+0x93): undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, sf::WindowSettings const&)'
collect2: ld returned 1 exit status
Which leads me to believe the linking and installation is working fine but I'm confused what's wrong.
I checked the source from the git repository pointed to in the PKGBUILD and it looks like I'm using the API properly (and in accordance with the documentation on the site).
Anyone use SFML and could lend me a hand, please? I'll post on the sfml-dev forums but I was wondering if the problem was related to something I'm doing wrong in arch.
Thanks for any help!
Offline
How about you rearrange the libraries, sometimes you need to link things in a specific order. E.g.:
g++ main.cpp -o main -lsfml-system -lsfml-window -lsfml-graphics
EDIT: My advice may be wrong, since I believe the linker order only matters for static linking, and you appear to have only shared libraries.
Last edited by krigun (2012-03-24 01:14:35)
Offline
Pages: 1