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

Author Topic: Unable to compile SFML program in Ubuntu 12.10  (Read 2780 times)

0 Members and 2 Guests are viewing this topic.

The Illusionist Mirage

  • Full Member
  • ***
  • Posts: 115
  • My Life = Linux, C++ & Computers
    • View Profile
    • fleptic
    • Email
Unable to compile SFML program in Ubuntu 12.10
« on: September 15, 2013, 03:38:51 pm »
Hello

I can't compile the following code in Code::Blocks in Ubuntu 12.10:
#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;
}
 

When sing Code::Blocks, I've mentioned in the search directories where the includes and libs are under the compiler and debugger settings. I've also done the necessary steps in the project build options too. But still getting an error.

I've compiled SFML sources and have  built the libs from from make files at the path /home/user404/Libraries/SFML_2_1

Also, whenever I build my program in debug version, this error pops up:
libGLEW.so.1.7 needed by /home/user404/Libraries/SFML_2_1/lib/libsfml-graphics.so, not found

And when I try to install libGLEW.so.1.7 as sudo apt-get install libglew1.7-dev, this happens in the terminal:

Reading package lists... Done
uilding state information... Done
E: Unable to locate package libglew1.7-dev
E: Couldn't find any package by regex 'libglew1.7-dev'


Any suggestions where's the problem?

Thanks

EDIT:
Also, when I am trying to generate makefiles using cmake cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=FALSE, an error pops up :

CMake Error : The source directory "/home/user404/Downloads/SFML_2_1/BUILD_SHARED_LIBS=TRUE" does not exist.

But the part BUILD_SHARED_LIBS=TRUE has nothing to with the search directory
« Last Edit: September 15, 2013, 03:49:53 pm by The illusionist mirage »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Unable to compile SFML program in Ubuntu 12.10
« Reply #1 on: September 15, 2013, 04:19:44 pm »
Quote
But still getting an error.
Which one?

Quote
Also, when I am trying to generate makefiles using cmake cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug -D BUILD_SHARED_LIBS=FALSE, an error pops up :

CMake Error : The source directory "/home/user404/Downloads/SFML_2_1/BUILD_SHARED_LIBS=TRUE" does not exist.
There's no space between -D and the variable name.
Laurent Gomila - SFML developer

The Illusionist Mirage

  • Full Member
  • ***
  • Posts: 115
  • My Life = Linux, C++ & Computers
    • View Profile
    • fleptic
    • Email
Re: Unable to compile SFML program in Ubuntu 12.10
« Reply #2 on: September 15, 2013, 06:17:38 pm »
There's no space between -D and the variable name.

Even after inserting a space it doesn't works.

And the error I am talking about:
libGLEW.so.1.7 needed by /home/user404/Libraries/SFML_2_1/lib/libsfml-graphics.so, not found

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Unable to compile SFML program in Ubuntu 12.10
« Reply #3 on: September 15, 2013, 08:33:13 pm »
Quote
Even after inserting a space it doesn't works
I meant that you have a space whereas there should be none.

Quote
And the error I am talking about:
libGLEW.so.1.7 needed by /home/user404/Libraries/SFML_2_1/lib/libsfml-graphics.so, not found
Ah. Since you said "also", I thought this was another one ;)
If it's not available in the official repositories, you can download it and compile it.
Laurent Gomila - SFML developer