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

Author Topic: Install on Debian Linux with Codeblocks and g++  (Read 3168 times)

0 Members and 1 Guest are viewing this topic.

nvangogh

  • Newbie
  • *
  • Posts: 21
    • View Profile
Install on Debian Linux with Codeblocks and g++
« on: July 03, 2012, 08:42:20 pm »
Hello,
I recently printed off the instructions for installing SFML and followed them very carefully. I downloaded the full SDK for Linux - 32 bit which (I understood contained everything needed). I followed the instructions for setting codeblocks compiler and linker settings. The first time i attempted to compile the Clock example - I got a message that a shared library was missing.

Now this may be where I started to go wrong.

I used the package manager to download the debian (version 1.6)  libsfml-dev, libsfml-network, libsfml-window,libsfml- system,libsfml- graphics libsfml-audio. I recompiled the Clock example and it worked. The problem was that it should have worked without me downloading the debian versions. I studied the tutorial again online and then saw that there was a section on compiling SFML (for advanced users). I ignored it the first time because i do not consider myself to be advanced. But this section stated that the downloaded SDK needed to be compiled. So I did the following:

1. apt-get build-dep libsfml
2. make    STATIC = YES            # builds the SFML libraries
3. sudo make install   # installs the compiled libraries
4. make sfml-samples   # compiles the SFML examples

I then attempted to compile a simple program and i am posting only a few relevant  lines here:
-----------------------------code-------------------------
#include <SFML/Window.hpp>
int main()
{

// get best fullscreen mode
    sf::Window ascreen;
    ascreen.Create(sf::VideoMode::GetMode(0), "pacman", sf::Style::Fullscreen);
............................
Now this fails to compile - with excess of 50 errors. I have read previous posts where these errors are identified, but cannot figure out what I am doing wrong. Please note that again I only refer to a few of the errors as they all appear to be from the same problem:
Errors:----------------------------------
/home//SFML-1.6/lib/libsfml-window-s.a(VideoModeSupport.o)||In function sf::priv::VideoModeSupport::GetDesktopVideoMode()':|

VideoModeSupport.cpp|| undefined reference to `XQueryExtension'|
VideoModeSupport.cpp|| undefined reference to `XRRGetScreenInfo'|
VideoModeSupport.cpp|| undefined reference to `XRRConfigCurrentConfiguration'|
VideoModeSupport.cpp|| undefined reference to `XRRConfigSizes'|
VideoModeSupport.cpp|| undefined reference to `XRRFreeScreenConfigInfo'|
 ETC........

Please can you advise me on how to correct these errors? I have been trying on my own for over a week to work things out but have made no progress. I would be grateful for any help that you can give me.

Kind Regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Install on Debian Linux with Codeblocks and g++
« Reply #1 on: July 03, 2012, 08:56:36 pm »
You need to link to all the depencies of SFML as well. But static build on Linux is useless, don't do that.

You don't even need to compile SFML. The precompiled libraries are not there just to trigger errors, you know ;)

Where did you install SFML?
Laurent Gomila - SFML developer

nvangogh

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Install on Debian Linux with Codeblocks and g++
« Reply #2 on: July 03, 2012, 09:14:09 pm »
Hello Laurant,
I have the SFML 1.6 file in my home directory. Now I have also seen that there is a SFML file in /usr/include.

Does the problem appear to be just with the linker settings under the project build options? Or do I need to alter the global settings? I am not sure what changes I need to make.


Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Install on Debian Linux with Codeblocks and g++
« Reply #3 on: July 03, 2012, 11:08:51 pm »
Your initial problem was that the library loader (ld) couldn't find SFML libraries because they weren't in a standard path. You should rather learn more about ld and how to add a library path, rather than trying to recompile SFML ;)
Laurent Gomila - SFML developer

nvangogh

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Install on Debian Linux with Codeblocks and g++
« Reply #4 on: July 03, 2012, 11:47:57 pm »
Thank you,
I changed the linker settings in codeblocks and my little test program worked - fullscreen  but no way of getting out :)
I am going to be using sfml in codeblocks and via emacs over the next few months to learn how to use the library properly. This is the first experience I have had of C++ and a 'third party' library and that is why i am a little bit confused.

Regards