SFML community forums

Help => General => Topic started by: linc186 on May 21, 2013, 06:01:26 am

Title: Problem with linking - Arch Linux - 64-bit GCC compiler
Post by: linc186 on May 21, 2013, 06:01:26 am
Hello!

I'm new to SFML 2.0, I just switched over from SDL. As the title says, I'm running archlinux and am trying to use the SFML 2.0 API with the 64-bit GCC compiler. I downloaded the 64-bit version and placed it into the standard path, /usr/local/SFML-2.0/. I followed the setting up with Linux tutorial on the wiki step-by-step, and can get it to compile with this:

$ g++ -c main.cpp -I /usr/local/SFML-2.0/include/
 

but when I link with this command,

$ g++ main.o -o sfml-app -L /usr/local/SFML-2.0/lib/ -lsfml-graphics -lsfml-window -lsfml-system
 

I get these errors:

/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
 

Any help is appreciated, thank you!

Oh, also, sorry if highlighting or formatting in the commands is off. There's no bash option in the code tags, so I just tagged them inside c++ tags.
Title: Re: Problem with linking - Arch Linux - 64-bit GCC compiler
Post by: Laurent on May 21, 2013, 07:59:58 am
Do you have libjpeg and libglew installed?
Title: Re: Problem with linking - Arch Linux - 64-bit GCC compiler
Post by: linc186 on May 21, 2013, 08:45:59 am
I just installed the two packages, and judging from the error messages, it looks like it wants me to link the libglew and libjpeg libraries (which would explain the undefined reference errors). I installed the package, but I'm not entirely sure where the library files are located, but I'm sure I can find out with a quick google search and then link them, that should fix it.

Thank you for your help!
Title: Re: Problem with linking - Arch Linux - 64-bit GCC compiler
Post by: Laurent on May 21, 2013, 09:01:11 am
No, you're not supposed to do that. If you read the error message carefully, you'll notice that it cannot find the libraries, which means that it tries to link them.

Maybe it's just a version mismatch, it happens sometimes. In this case you'd better recompile SFML yourself.
Title: Re: Problem with linking - Arch Linux - 64-bit GCC compiler
Post by: linc186 on May 21, 2013, 09:06:14 am
Oh, okay, thanks for clearing that up for me!

I'll follow the wiki to compile SMFL.

Thanks again!