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

Author Topic: Static linking produces a lot of undefined reference errors  (Read 1129 times)

0 Members and 1 Guest are viewing this topic.

Karma

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hello!

Just before posting I checked my MinGW one more time and spotted libgcc_s_dw2-1.dll file in MinGW/bin. After installing SFML 2.0 RC DW2 everything works fine. Seems like mingw-get downloads the Dwarf2 version, not the SJLJ one as I previously thought, so the reason was obviously compiler and library version discrepancy.

I am posting this nevertheless for people who might encounter similar problem in the future.

Original message below.



I have been using SFML 1.6 for quite some time already and after finishing my university project finally decided to transfer to SFML 2.0. I have downloaded the latest MinGW version through mingw-get, updated my Code::Blocks to the newest nightly (build 8086 at the time of writing) and also gave Eclipse CDT Juno (32-bit since the 64-bit version has some nasty bugs) another try as I have yet to settle for a single IDE. Also, I am using MinGW 4.6.2 under Windows 7 Ultimate x64 SP1.

At first I used dynamic library linking and everything went smooth, with the exception of both IDEs not being able to run the binary without the DLL files being in the same directory even though I have SFML's bin directory in my PATH system variable. Code::Blocks was kind enough to tell me about it not being able to find the DLL files, unlike Eclipse.

Static linking was next. Defined SFML_STATIC and set up library linking order as follows: sfml-graphics-s-d, sfml-window-s-d, sfml-system-s-d (since I am building debug in this case). And it just won't compile. Code::Blocks reports over 650 errors that you can see here: http://pastebin.com/rySV8n8b. And here is my test code: http://pastebin.com/Jbf7yAPX. Compiling through Eclipse gives more or less (circa 500 errors for some reason) the same effect.



I have read a lot concerning similar problems and what seemed to cause most of them was: using different versions of linker and compiler, using DW2 MinGW with SJLJ SFML or compiling SFML and applications using it with different versions of compiler. I am: using the same version of linker and compiler from MinGW package, both are SJLJ exception handling versions and I did not compile SFML 2.0 RC, I just downloaded it.

Would you please help me with this issue?




Thanks anyway!


Edit: As you wish, Laurent.
« Last Edit: July 13, 2012, 07:28:56 pm by Karma »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Static linking produces a lot of undefined reference errors
« Reply #1 on: July 13, 2012, 06:48:27 pm »
Next time please post the solution at the beginning, so that people don't read the whole message for nothing ;)
Laurent Gomila - SFML developer