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

Author Topic: SFML2 installation on Linux?  (Read 2146 times)

0 Members and 1 Guest are viewing this topic.

fatum

  • Newbie
  • *
  • Posts: 47
    • MSN Messenger - bowsers7@hotmail.com
    • AOL Instant Messenger - therealblah569
    • View Profile
    • http://boards.psynetfm.com
SFML2 installation on Linux?
« 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:
Code: [Select]

#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:
Code: [Select]

g++ -o test test.cpp -lsfml-graphics -lsfml-window


This is what is returned:
Code: [Select]

/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!

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
SFML2 installation on Linux?
« Reply #1 on: September 16, 2011, 06:55:52 am »
Copy all the .so in /usr/local/lib or /usr/lib

You may need to do that with the console

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML2 installation on Linux?
« Reply #2 on: September 16, 2011, 07:44:25 am »
Quote
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.

Quote
This is what is returned

You're linking against SFML 1.6 libraries. You should remove it completely to avoid such problems.
Laurent Gomila - SFML developer

unranked86

  • Newbie
  • *
  • Posts: 37
    • View Profile
SFML2 installation on Linux?
« Reply #3 on: September 16, 2011, 04:23:18 pm »
I think using your ditribution's package manager is the simpliest way...

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
SFML2 installation on Linux?
« Reply #4 on: September 16, 2011, 04:26:58 pm »
Quote from: "unranked86"
I think using your ditribution's package manager is the simpliest way...

Don't forget that SFML 2 hasn't been released yet.
Laurent Gomila - SFML developer

unranked86

  • Newbie
  • *
  • Posts: 37
    • View Profile
SFML2 installation on Linux?
« Reply #5 on: September 17, 2011, 12:17:42 pm »
Quote from: "Laurent"
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.)
Code: [Select]
cmake -DCMAKE_INSTALL_PREFIX=/usr/ .. -DBUILD_DOC=true -DBUILD_EXAMPLES=true


3.)
Code: [Select]
make
make doc

Then as root:
Code: [Select]
make install

Here is the package for Arch (from AUR): link (check the PKGBUILD)

 

anything