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

Author Topic: Problems compiling a program on Ubuntu  (Read 1696 times)

0 Members and 1 Guest are viewing this topic.

bacondude95

  • Newbie
  • *
  • Posts: 11
    • View Profile
Problems compiling a program on Ubuntu
« on: February 02, 2014, 06:25:03 am »
Since I'm wanting to go into the game industry I thought it would be a good practice to get used to making cross-platform software.
I downloaded SFML 2.1 for Ubuntu 12.10 and followed the instructions. I'm currently using the 64 bit package of SFML since there are more instructions for 32-bit and decided I'll get into compiling with 32-bit later. Anyways I downloaded, and installed correctly, but having problems compiling. Okay maybe it's not compiling part exactly but more like the linking part to get the final executable(I also have all the .so files in the directory).

Whenever I link it I get this:


What does this mean?!
If it helps here is the code
#include <SFML/Graphics.hpp>


int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
        window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}

 
If any other information is needed feel free to ask.

[/size]

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: Problems compiling a program on Ubuntu
« Reply #1 on: February 02, 2014, 06:57:27 am »
Try running
sudo apt-get install libjpeg62-dev
Looks like you're missing one of SFML's dependencies (the jpeg development library).

How did you install SFML?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1404
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Problems compiling a program on Ubuntu
« Reply #2 on: February 02, 2014, 07:03:25 am »
You need to install the dependencies, they are listed here.
You also need to link to the dependencies when building your application as explained in the FAQ (ignore the static part, you need to do it for dynamic linking as well).

If you downloaded the pre-compiled library from the SFML website, then more likely than not, something will not want to work. Building from source is so easy in Linux that it is the only thing I can recommend people to do.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

bacondude95

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Problems compiling a program on Ubuntu
« Reply #3 on: February 02, 2014, 07:12:08 am »
You need to install the dependencies, they are listed here.
You also need to link to the dependencies when building your application as explained in the FAQ (ignore the static part, you need to do it for dynamic linking as well).

If you downloaded the pre-compiled library from the SFML website, then more likely than not, something will not want to work. Building from source is so easy in Linux that it is the only thing I can recommend people to do.
I was actually going to use CMake and build it, but I was having problems finding the libraries and which versions to download, etc
Anything to help me out?

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1404
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Problems compiling a program on Ubuntu
« Reply #4 on: February 02, 2014, 07:31:27 am »
Code: [Select]
sudo apt-get install git cmake libfreetype6-dev libglew-dev libglu1-mesa-dev libjpeg8-dev libogg-dev libopenal-dev libpng12-dev libpthread-stubs0-dev libsndfile1-dev libvorbis-dev libxrandr-dev mesa-common-dev zlib1g-dev
git clone https://github.com/SFML/SFML.git
cd SFML
cmake .
make
sudo make install
sudo ldconfig
Maybe a bit more than you need, but it doesn't hurt to have a few spare libraries for when you need them...
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

bacondude95

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: Problems compiling a program on Ubuntu
« Reply #5 on: February 02, 2014, 06:58:43 pm »
Thanks for you help!!!

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Problems compiling a program on Ubuntu
« Reply #6 on: February 03, 2014, 10:23:40 am »
An easy way in Ubuntu to get alle dependencies is to just install den dependencies of the old SFML-package (1.6)

sudo apt-get build-dep libsfml-dev

This will only install the dependencies without the actual package.

 

anything