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

Author Topic: SFML 2.0 Linux installation issue  (Read 3130 times)

0 Members and 1 Guest are viewing this topic.

chakal

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
SFML 2.0 Linux installation issue
« on: January 17, 2016, 08:35:40 pm »
Hello,
I am trying without sucess to install SFML 2.0 on a Ubuntu 15.10. Up until now, I worked on SFML in Windows CodeBlocks and I didn't have any serious issues with the installation under Windwos.

However, I am having a lot of trouble when trying to install SFML 2.0 on Ubuntu depsite following the tutorial in the SFML website. I  downloaded the Linux archive from the link http://www.sfml-dev.org/download/sfml/2.0/. After that I extracted the archive to /usr/local/ directory. I try to compile the code main.cpp from the following tutorial: http://www.sfml-dev.org/tutorials/2.0/start-linux.php
When I compile the code with:
g++ main.cpp -o main.o -L/usr/local/include -lsfml-graphics -lsfml-window -lsfml-system
I get:
/usr/bin/ld: cannot find -lsfml-graphics
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: cannot find -lsfml-system

When I compile the code simply with:
g++ main.cpp -o main.o -lsfml-graphics -lsfml-window -lsfml-system
I am getting:
fatal error: SFML/Graphics.hpp: No such file or directory.

Can you tell what should I do to install properly SFML 2.0 on my machine?
Thank you in advance.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML 2.0 Linux installation issue
« Reply #1 on: January 17, 2016, 08:49:25 pm »
Quote
-L/usr/local/include
-L is the linker directory. -I is the include directory.

To avoid future issues, try also sudo ldconfig.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10838
    • View Profile
    • development blog
    • Email
SFML 2.0 Linux installation issue
« Reply #2 on: January 17, 2016, 08:50:14 pm »
The library files are obviously not located in /usr/local/include, but probably in /usr/local/lib or similar.
It's important that you understand what the commands you enter mean exactly. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

chakal

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: SFML 2.0 Linux installation issue
« Reply #3 on: January 17, 2016, 09:06:22 pm »
When I compile with
g++ main.cpp -o main.o -I/usr/local/SFML-2.0/include -lsfml-graphics -lsfml-window -lsfml-system
I get:
/usr/bin/ld: cannot find -lsfml-graphics
/usr/bin/ld: cannot find -lsfml-window
/usr/bin/ld: cannot find -lsfml-system

When compiling with:
g++ main.cpp -o main.o -L/usr/local/SFML-2.0/lib -lsfml-graphics -lsfml-window -lsfml-system I get
fatal error: SFML/Graphics.hpp: No such file or directory.

When compiling with
g++ main.cpp -o main.o -L/usr/local/lib -lsfml-graphics -lsfml-window -lsfml-system I get
fatal error: SFML/Graphics.hpp: No such file or directory.

Can you tell me what to do to compile the code? Thank you

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML 2.0 Linux installation issue
« Reply #4 on: January 17, 2016, 09:09:35 pm »
Have you thought about providing include and library directory? ;)

You should really read the basic documentation of your compiler when you want to program in C++...
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

chakal

  • Newbie
  • *
  • Posts: 6
    • View Profile
    • Email
Re: SFML 2.0 Linux installation issue
« Reply #5 on: January 17, 2016, 09:30:10 pm »
Thank you for your reply.
Right now, I compile with
g++ main.cpp -o main.o -L/usr/local/SFML-2.0/lib -I/usr/local/SFML-2.0/include -lsfml-window -lsfml-system

However,I've got an awful lot of error messages such as:
 g++ -Wall main.cpp -o main -I/usr/local/SFML-2.0/include/ -L/usr/local/SFML-2.0/lib -lsfml-graphics -lsfml-window -lsfml-system
/usr/bin/ld: warning: libGLEW.so.1.5, needed by /usr/local/SFML-2.0/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libjpeg.so.62, needed by /usr/local/SFML-2.0/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_finish_compress@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_write_scanlines@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewUniform1fARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_std_error@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shader_objects'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewGetObjectParameterivARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_vertex_shader'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewFramebufferTexture2DEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewUniformMatrix4fvARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_set_quality@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewGenFramebuffersEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewUniform3fARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_set_defaults@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewRenderbufferStorageEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_CreateCompress@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_fragment_shader'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewActiveTextureARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_start_compress@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewShaderSourceARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `glewInit'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewBindFramebufferEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewFramebufferRenderbufferEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewLinkProgramARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewUseProgramObjectARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewBlendFuncSeparateEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewGenRenderbuffersEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewUniform2fARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_destroy_compress@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewUniform4fARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewCreateProgramObjectARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `glewGetErrorString'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewCompileShaderARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewDeleteRenderbuffersEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewDeleteObjectARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewGetUniformLocationARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewGetInfoLogARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__GLEW_EXT_blend_func_separate'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewDeleteFramebuffersEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewCheckFramebufferStatusEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewUniform1iARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_texture_non_power_of_two'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `jpeg_stdio_dest@LIBJPEG_6.2'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__GLEW_ARB_shading_language_100'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewCreateShaderObjectARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewBindRenderbufferEXT'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__GLEW_EXT_framebuffer_object'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewAttachObjectARB'
/usr/local/SFML-2.0/lib/libsfml-graphics.so: undefined reference to `__glewGetHandleARB'
collect2: error: ld returned 1 exit status
george@george-VirtualBox:~/Desktop$


In my view, this problem is always related to the linking. Can you please tell me how to solve this issue so that my code compiles at the end?
Thank you
« Last Edit: January 17, 2016, 09:45:17 pm by chakal »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6286
  • Thor Developer
    • View Profile
    • Bromeon
Re: SFML 2.0 Linux installation issue
« Reply #6 on: January 17, 2016, 11:26:55 pm »
Please take some time to read the tutorials. You're not linking all the required libraries.

By the way, I would use SFML 2.3.2; there's no reason to start with 2.0 which has been outdated for years.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

SeriousITGuy

  • Full Member
  • ***
  • Posts: 123
  • Still learning...
    • View Profile
Re: SFML 2.0 Linux installation issue
« Reply #7 on: January 18, 2016, 03:26:03 pm »
/usr/bin/ld: warning: libGLEW.so.1.5, needed by /usr/local/SFML-2.0/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libjpeg.so.62, needed by /usr/local/SFML-2.0/lib/libsfml-graphics.so, not found (try using -rpath or -rpath-link)

You should read more carefully, the problem is right in the first lines of your error message. SFML has additional dependencies which are not provided via the official download for linux binaries. You need to install them by yourself.
Best option would be to build SFML 2.3.2 yourself from source.