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

Author Topic: Static Link Errors  (Read 20958 times)

0 Members and 2 Guests are viewing this topic.

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Static Link Errors
« Reply #30 on: November 24, 2013, 09:10:06 pm »
@Joshua: You're missing the runtime, which is expected to be statically linked for you. Try adding -static-libgcc -static-libstdc++ to your linker command line.

amir ramezani

  • Jr. Member
  • **
  • Posts: 81
  • i'm a programmer who can't see well
    • View Profile
    • download useful software!
    • Email
Re: Static Link Errors
« Reply #31 on: November 25, 2013, 12:01:12 pm »
i mentioned it
but it doesn't work
his problem have been solved
if you can't see well, you can't test your applications and operating system well
my game engine:
allegro game creator
my operating system:
AmirOS

achpile

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • Achpile's homepage
    • Email
Re: Static Link Errors
« Reply #32 on: June 24, 2014, 12:39:20 am »
Excuse me, if I wrong.
Does it normal, that static linkage goes without errors only with "-s-d" libs?

When I'm trying to statically link with "-s" the tons of errors comes to build log:

-- Configuring done
-- Generating done
-- Build files have been written to: D:/untitled2
Linking CXX executable untitled.exe
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x12b): undefined reference to `glDeleteTextures@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x192): undefined reference to `__GLEW_ARB_texture_non_power_of_two'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x1c5): undefined reference to `__GLEW_ARB_texture_non_power_of_two'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x1fd): undefined reference to `glGetIntegerv@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x44c): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x499): undefined reference to `glTexImage2D@36'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x4c4): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x4ef): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x515): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x53b): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x60f): undefined reference to `glGenTextures@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x74c): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x777): undefined reference to `glGetTexImage@20'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x8e3): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x911): undefined reference to `glGetTexImage@20'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x9f4): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xa3a): undefined reference to `glTexSubImage2D@36'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xb3f): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xb86): undefined reference to `glTexSubImage2D@36'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xcac): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xcf2): undefined reference to `glTexSubImage2D@36'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xea9): undefined reference to `glFlush@0'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xeeb): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xf40): undefined reference to `glTexSubImage2D@36'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0xf53): undefined reference to `glFlush@0'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x12bc): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x1300): undefined reference to `glTexSubImage2D@36'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x140d): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x145e): undefined reference to `glCopyTexSubImage2D@32'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x156d): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x15bc): undefined reference to `glCopyTexSubImage2D@32'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x16be): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x16e4): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x170a): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x178e): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x17b9): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x17e4): undefined reference to `glTexParameteri@12'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x184a): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x1859): undefined reference to `glMatrixMode@4'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x1861): undefined reference to `glLoadIdentity@0'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x186d): undefined reference to `glMatrixMode@4'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x188c): undefined reference to `glBindTexture@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x193f): undefined reference to `glMatrixMode@4'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x194d): undefined reference to `glLoadMatrixf@4'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x195c): undefined reference to `glMatrixMode@4'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x19ba): undefined reference to `glGetIntegerv@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x1b72): undefined reference to `glDeleteTextures@8'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj):Texture.cpp:(.text+0x1cb4): undefined reference to `__GLEW_ARB_texture_non_power_of_two'
D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/bin/ld.exe: D:/Qt/Tools/mingw482_32/bin/../lib/gcc/i686-w64-mingw32/4.8.2/../../../../i686-w64-mingw32/lib/../lib\libsfml-graphics-s.a(Texture.cpp.obj): bad reloc address 0x17 in section `.text.unlikely'
collect2.exe: error: ld returned 1 exit status
CMakeFiles\untitled.dir\build.make:88: recipe for target 'untitled.exe' failed
CMakeFiles\Makefile2:62: recipe for target 'CMakeFiles/untitled.dir/all' failed
Makefile:74: recipe for target 'all' failed
mingw32-make[2]: *** [untitled.exe] Error 1
mingw32-make[1]: *** [CMakeFiles/untitled.dir/all] Error 2
mingw32-make: *** [all] Error 2
 

CMake file:
project(untitled)
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
SET( CMAKE_CXX_FLAGS  "-DSFML_STATIC" )
SET( CMAKE_EXE_LINKER_FLAGS  "-static-libgcc -static-libstdc++ -static" )

target_link_libraries(untitled sfml-graphics-s sfml-window-s sfml-system-s)
 

Source:
#include <SFML/Graphics.hpp>

int main()
{
    sf::Texture b;
    return 0;
}
 

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Static Link Errors
« Reply #33 on: June 24, 2014, 01:51:48 am »
If you link statically you have to link all the dependencies, see here.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

achpile

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • Achpile's homepage
    • Email
Re: Static Link Errors
« Reply #34 on: June 24, 2014, 06:32:21 am »
Wow... Now I've got it ;) Thanks a lot, eXpl0it3r!


Mörkö

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
Re: Static Link Errors
« Reply #35 on: June 24, 2014, 07:01:45 am »
If you link statically you have to link all the dependencies, see here.
I did this and tried to launch the program on another computer, but got an error saying could not launch program because of `missing file msvcp120.dll`

I guess that's a Windows specific issue, and some googling got me an article by Microsoft recommending the developer to build some kind of extracting package or something. I didn't have time to try it yet.
« Last Edit: June 24, 2014, 07:03:59 am by Mårran »

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Static Link Errors
« Reply #36 on: June 24, 2014, 07:30:26 am »
Most non-trivial programs built with Visual C++ require the Visual C++ Redistributable Package (containing various runtime libraries) to be installed in order to run. Alternatively you can package the required dll's alongside your application.
See http://msdn.microsoft.com/en-us/library/vstudio/ms235299.aspx
« Last Edit: June 24, 2014, 07:33:44 am by Jesper Juhl »