0

I'm losing hope to finish my work. I did a game with irrlicht on Code Blocks. I linked irrlicht it works but impossible to link irrKlang... It shows me the same message each time.

x86_64-w64-mingw32-g++.exe -Llib\irrlicht-1.8.3\lib\Win32-gcc -Llib\irrKlang-1.5.0\lib\Win32-gcc -Llib\irrlicht-1.8.3\lib\Win32-gcc -Llib\irrKlang-1.5.0\lib\Win32-gcc -Llib\irrKlang-1.5.0\bin\win32-gcc -o BomberPark.exe .objs\main.o .objs\srcs\AppSetting.o .objs\srcs\Bombs.o .objs\srcs\Camera.o .objs\srcs\Sound.o:Sound.cpp:(.text+0x24): undefined reference to irrklang::createIrrKlangDevice(irrklang::E_SOUND_OUTPUT_DRIVER, int, char const*, char const*)' collect2.exe: error: ld returned 1 exit status

I did these things: I added the libirrklang.a in link librairies and add the directory of the includes in compiler + added the lib directory in linker so I wanted to know what else can I do to resolve my problem please?

The screenshots of my configuration for the linker:

conf1

conf3

killmat
  • 113
  • 1
  • 4
  • To get help with a linkage error you need to post the at least the failing linker command and the errors that follow from it, copied from the build log. You'll find the build log in the Code::Blocks **Build log** tab (not the **Build messages** tab) after a failing build. The failing linker command is the last `g++ ...` command in the build log, followed by the errors. – Mike Kinghan Jun 04 '16 at 18:59
  • I edited my post but I'm really stuck with this... I followed every tutorials I found to the letter and it refuses to compile... I linked irrlicht to my project but irrklang doesn't want to be linked ... @MikeKinghan – killmat Jun 04 '16 at 20:25
  • "I added the libirrklang.a in link librairies". That linker commandline says you haven't. You've got 5 `-Ldirectory` options (2 of them duplicates of others) to tell the linker what dirs to search for the libraries, but you have no `-lirrKlang` to tell it search for `libirrKlang.a`. You have no `-l` (library) options at all. You'd better post screenshots of your project's **Build options** -> **Linker settings** and **Build options** -> **Compiler settings**. – Mike Kinghan Jun 04 '16 at 22:21
  • I put in my post the screenshots of my Build options -> Linker Settings & Build options -> Search Directories -> Linker. I swear that the libs.a are in these directories. I also added the include directories of my libs and my project to compiler so that's why I'm stucked. @MikeKinghan – killmat Jun 05 '16 at 05:33
  • @kilmat: It doesn't matter whether those directories contain the relevant libraries. You have to link with the libraries. Or library. – Cheers and hth. - Alf Jun 05 '16 at 08:50
  • ok but I thought when I added them in the linker settings it was good? however how can I do that? @Cheersandhth.-Alf – killmat Jun 05 '16 at 08:52
  • @kilmat The screenshots can't account for the commandline, but they don't indicate which target of three targets you're building or the policy by which target options inherit project options (or don't). Anyhow even if you sorted the C::B config you couldn't build the project because you're trying to link 32-bit libraries (`lib\Win32-gcc\libIrrlicht.a`,`\bin\win32-gcc\irrKlang.dll`) with a 64-bit compiler (`x86_64-w64-mingw32-g++.exe`) and its 64-bit standard libraries, which won't work. 64|32-bit binaries link with matching toolchain. – Mike Kinghan Jun 05 '16 at 09:22
  • @kilmat And there's other strangeness in your config. You're trying to instruct a GUI (CodeBlocks) to drive GNU `make` and the GCC commandline compiler and linker to build your project while you don't well understand how to drive them yourself. Take a step back and learn, for instance, how to compile and link the programs in `irrKlang-1.5.0\examples` with GCC at the command prompt. Use [this tutorial](https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html) to get going. When you can do that you'll no longer flounder with Code::Blocks. – Mike Kinghan Jun 05 '16 at 09:22
  • With gcc you link a library by using the lowercase `-l` option. – Cheers and hth. - Alf Jun 05 '16 at 09:59

0 Answers0