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

Author Topic: Code::Blocks cannot find sfml-graphics-d, sfml-audio-d, etc.  (Read 4856 times)

0 Members and 1 Guest are viewing this topic.

DyFxvt

  • Newbie
  • *
  • Posts: 5
    • View Profile
Code::Blocks cannot find sfml-graphics-d, sfml-audio-d, etc.
« on: August 15, 2020, 04:41:53 pm »
You've probably heard this one a million times, but in the IDE I'm using (Code::Blocks), it cannot find
the files I'm trying to link, like sfml-graphics-d, sfml-audio-d, etc.

I followed a tutorial, but when it didn't work I tried compiling the source like the video said,
but of course with my luck CMake couldn't find the files I was trying to use and gave an error.
(It's always the compilers that get me, I'm surprised I was even able to build a Hello World program :( )

I have tried this with both the "GCC 5.1.0 TDM (SJLJ)" and "GCC 7.3.0 MinGW (DW2)" versions,
and tried the ladder with both the 64 and 32bit versions of Code::Blocks.

The build log confuses me even more...
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\_Libraries\SFML-2.5.1\lib/libsfml-graphics-d.a when searching for -lsfml-graphics-d
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\_Libraries\SFML-2.5.1\lib\libsfml-graphics-d.a when searching for -lsfml-graphics-d
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: skipping incompatible C:\Program Files (x86)\CodeBlocks\MinGW\_Libraries\SFML-2.5.1\lib/libsfml-graphics-d.a when searching for -lsfml-graphics-d
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/x86_64-w64-mingw32/8.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lsfml-graphics-d
(I get these same 4 lines for the rest of the things I tried to link)

I have double, tripple, quadruple checked to make sure I got the linker settings right.
I also tried to set my project's build target to "release", but I get the same errors (minus the "-d" at the end of the file names)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Code::Blocks cannot find sfml-graphics-d, sfml-audio-d, etc.
« Reply #1 on: August 15, 2020, 09:42:11 pm »
"Incompatible" probably means not the right architecture (32/64 bits).
Laurent Gomila - SFML developer

DyFxvt

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Code::Blocks cannot find sfml-graphics-d, sfml-audio-d, etc.
« Reply #2 on: August 15, 2020, 10:16:04 pm »
When I got this error message I believe I was using Code::Blocks 32bit with GCC 7.3.0 MinGW (DW2) 32bit.
I also got the same exact build log messages when I used GCC 5.1.0 TDM (SJLJ) 32bit.
Weird how this could have happened; or is there something else that's completely going over my head?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Code::Blocks cannot find sfml-graphics-d, sfml-audio-d, etc.
« Reply #3 on: August 16, 2020, 09:49:30 am »
Ok, so your compiler was a 32-bit one, what about your SFML libraries?
Laurent Gomila - SFML developer

DyFxvt

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Code::Blocks cannot find sfml-graphics-d, sfml-audio-d, etc.
« Reply #4 on: August 16, 2020, 04:20:25 pm »
32bit. I believe that's what I meant when I said I tried GCC 7.3.0 MinGW (DW2) 32bit and GCC 5.1.0 TDM (SJLJ) 32bit.

AngusGillott

  • Newbie
  • *
  • Posts: 2
    • View Profile
    • Email
Re: Code::Blocks cannot find sfml-graphics-d, sfml-audio-d, etc.
« Reply #5 on: January 03, 2022, 11:25:57 am »
Hey Laurent,

I've come to this thread because it is what comes up if you Google 'code blocks sfml cannot find lib'.

Please update the CodeBlocks tutorial, it has a very misleading tooltip: https://www.sfml-dev.org/download/sfml/2.5.1/

"There are multiple variants of GCC for Windows ... select the package which corresponds to the version that you use. If you are unsure, check which of the libgcc_s_sjlj-1.dll or libgcc_s_dw2-1.dll files is present in your MinGW/bin folder. If MinGW was installed along with Code::Blocks, you probably have an SJLJ version."

This is misleading, because the default compiler that comes with the default (64-bit) version of CodeBlocks is the "SEH" version. If an attentive beginner reader is following your tutorial, they won't be able to find "libgcc_s_sjlj-1.dll" or "libgcc_s_dw2-1.dll" in the MinGW folder (only "libgcc_s_seh-1.dll"). At this point they'll probably just cross their fingers and hope that they have the SJLJ version, because that's what you suggest.

The tutorial should mention that they might find the libgcc_s_seh-1.dll as one of three possible options.

 

anything