SFML community forums
Help => General => Topic started by: fatum on September 16, 2011, 05:34:28 am
-
I've moved the SFML directory inside of the "include" folder to /usr/include/c++/4.4, as well as all of the .a lib files into /usr/lib/gcc/i486-linux-gnu. Are these locations the appropriate place for the files to reside?
Here's the bit that I'm testing:
#include "SFML/Graphics.hpp"
const int SCREEN_WIDTH = 550;
const int SCREEN_HEIGHT = 400;
const int SCREEN_BPP = 32;
sf::RenderWindow App;
int main(int argc, char** argv)
{
App.Create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP), "Testing!");
while (App.IsOpened())
{
sf::Event event;
while (App.PollEvent(event))
{
switch (event.Type)
{
case sf::Event::Closed:
App.Close();
break;
}
}
}
return EXIT_SUCCESS;
}
I'm compiling with:
g++ -o test test.cpp -lsfml-graphics -lsfml-window
This is what is returned:
/tmp/ccrxrxoF.o: In function `main':
test.cpp:(.text+0x87): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
test.cpp:(.text+0xc3): undefined reference to `sf::Window::Create(sf::VideoMode, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned long, sf::ContextSettings const&)'
test.cpp:(.text+0x125): undefined reference to `sf::Window::Close()'
test.cpp:(.text+0x139): undefined reference to `sf::Window::PollEvent(sf::Event&)'
test.cpp:(.text+0x149): undefined reference to `sf::Window::IsOpened() const'
/tmp/ccrxrxoF.o: In function `__static_initialization_and_destruction_0(int, int)':
test.cpp:(.text+0x17c): undefined reference to `sf::RenderWindow::RenderWindow()'
test.cpp:(.text+0x181): undefined reference to `sf::RenderWindow::~RenderWindow()'
collect2: ld returned 1 exit status
What could the issue be? Thanks for any help!
-
Copy all the .so in /usr/local/lib or /usr/lib
You may need to do that with the console
-
I've moved the SFML directory inside of the "include" folder to /usr/include/c++/4.4, as well as all of the .a lib files into /usr/lib/gcc/i486-linux-gnu. Are these locations the appropriate place for the files to reside?
No, you should rather set the CMAKE_INSTALL_PREFIX CMake variable and "make install" after compiling SFML. Don't copy files manually.
This is what is returned
You're linking against SFML 1.6 libraries. You should remove it completely to avoid such problems.
-
I think using your ditribution's package manager is the simpliest way...
-
I think using your ditribution's package manager is the simpliest way...
Don't forget that SFML 2 hasn't been released yet.
-
Don't forget that SFML 2 hasn't been released yet.
Sorry! That is true. But on my Arch there is a package for SFML 2 (sfml-git), so I was assuming that most of the distro's have a package for it aswell.
Well, this should work...
1.) Get the SFML git sources.
2.)
cmake -DCMAKE_INSTALL_PREFIX=/usr/ .. -DBUILD_DOC=true -DBUILD_EXAMPLES=true
3.)
make
make doc
Then as root:
make install
Here is the package for Arch (from AUR): link (https://aur.archlinux.org/packages.php?ID=48026) (check the PKGBUILD)