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

Author Topic: Linux compile error  (Read 1871 times)

0 Members and 1 Guest are viewing this topic.

JSB

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Linux compile error
« on: December 31, 2013, 07:11:52 pm »
I tried to use the method in the resources to compile the test file on ubuntu linux. It errored.
~$ g++ -c main.cxx
In file included from /usr/include/SFML/Window.hpp:40:0,
                 from /usr/include/SFML/Graphics.hpp:32,
                 from main.cxx:1:
/usr/include/SFML/Window/OpenGL.hpp:47:23: fatal error: GL/gl.h: No such file or directory
I installed it through the Ubuntu repository, (sudo apt-get install libsfml-dev) so shouldn't OpenGL.hpp exist?
:(
I’ve never gotten sfml to work on linux. windows, yes, but linux, for some reason, no. Which is a shame because I ceartainly like using g++ better than the Code::blocks I use on windows :( .

Spirro

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: Linux compile error
« Reply #1 on: January 01, 2014, 01:20:35 am »
I don't have much experience with Linux, but I have been heavily experimenting with different distributions lately and settled(for now) on Linux Mint 16 which is Ubuntu based.

One thing I noticed is that the libsfml-dev packages you can download on Linux are for SFML 1.6 which is terribly outdated.  The current version is 2.1.  The only way to reliably get the current version is to compile it yourself.  This isn't hard.  The directions on this page http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php are pretty straight forward.  It uses the cmake-gui example to compile and I did so on one distribution I tested, but used the command line on Mint.  I did have some problems, but searching the forums here I found http://en.sfml-dev.org/forums/index.php?topic=9808.msg67119#msg67119.  This post shows you which libs you need to apt-get in order to successfully compile SFML.  I'd suggest getting those first and then moving on to the compile process with cmake.

The final problem I had was actually getting the example program here http://www.sfml-dev.org/tutorials/2.1/start-linux.php to compile.  For some reason Mint decided to install my compiled SFML to a nonstandard directory and if you read the bottom of this page on how to compile an example you see you need to enter a command in the terminal.  This basically lets your system know where else to look for libraries and includes(I think).  After doing that I was able to compile and run several different SFML 2.1 programs and they worked flawlessly.

I know this isn't a real answer to your post, but a work around to get the newest version of SFML.  One thing I've been learning as I'm studying Linux is you have to be able to do work arounds a lot to get things working, but once you learn the tricks of the trade it is pretty easy.

G.

  • Hero Member
  • *****
  • Posts: 1592
    • View Profile
Re: Linux compile error
« Reply #2 on: January 01, 2014, 01:41:33 am »
Thanks to my high google skills, It looks like you should install the OpenGL development files;)

(and yes, don't use 1.6)
« Last Edit: January 01, 2014, 01:51:48 am by G. »

JSB

  • Newbie
  • *
  • Posts: 5
    • View Profile
    • Email
Re: Linux compile error
« Reply #3 on: January 01, 2014, 05:09:22 pm »
Thanks. I will build from source :P dangit, i was hoping aptitude would give me the easy way out :) .