1

Using netbeans 7.2 and the most recent version of MinGW (using installer) I can't use the libnoise library. I am properly including the header files, the auto completion confirms this, however the library is simply not working. There is a .lib file and a .dll. I have tried every possible combination of adding them under project > properties > Build > Linker as well as putting the .dll in the base project directory. Despite all this I am still getting undefined reference errors whenever I try and run the code. Does anyone know what to do?

David Hackett
  • 235
  • 2
  • 7

2 Answers2

2

I know that it is possible to link import library files (*.lib) with MinGW, but I still suggest to recompile libnoise.

With the current Makefile, this is not very easy and may break. Thus I've written a CMake script, which doesn't only work on Windows, but should work on all CMake supported platforms. In addition to this, I've cleaned up the directory structure. The code itself hasn't been touched and when you build a library it should essentially be the same as the current one.

libnoise on GitHub

After you've built your shared library, you'll have a libnoise.dll.a and libnoise.dll file. You then add libnoise.dll.a to the linking settings and put the DLL itself next to the binary, or in the working directory.

Community
  • 1
  • 1
Lukas
  • 2,461
  • 2
  • 19
  • 32
  • A hearty thanks for starting this project; without a working CMake or make file, I would have simply abandoned the library and went on to use something else or just implement the very basics myself. – Rabbit Jun 17 '13 at 20:52
0

You have to link the lib file (= adding it to linker libraries) and put the dll to

<project root>/dist/<...>/

(where your exe is put to). There's no need to add the dll to linker too.

Can you please post the error message you get?

  • Whenever I first add the library it is called "noise", here is the project settings and output for that: [Settings](http://i1136.photobucket.com/albums/n489/thepackett727/noiselibsettings_zpsdc7b56c9.png) [output](http://i1136.photobucket.com/albums/n489/thepackett727/noiseliboutput_zpsa33071b1.png) Because the actual file name is libnoise.lib I changed the name to "libnoise" and got this: [settings](http://i1136.photobucket.com/albums/n489/thepackett727/libnoiselibsettings_zpsab0de522.png) [output](http://i1136.photobucket.com/albums/n489/thepackett727/libnoiseliboutput_zps255484f7.png) – David Hackett Mar 07 '13 at 23:54
  • How did you add the .lib file? In the linker setting use *add library file...* to add it. –  Mar 08 '13 at 14:20
  • I used "add Library" before. On trying this I got the same error however. [Settings](http://i1136.photobucket.com/albums/n489/thepackett727/libnoiselibaddlibraryfileoptionsettings_zps2214f9f3.png) [Output](http://i1136.photobucket.com/albums/n489/thepackett727/libnoiseaddlibraryfileoutput_zpsc58cc350.png) I think that maybe there is an incompatibility between the complilers considering I'm using MinGW and the library was compiled in visual studio. It would explain an undefined reference to "vtable". I'm not sure how to fix this though. – David Hackett Mar 08 '13 at 23:36
  • Please clear *additional libraries folder* (now there's *bin* set) and try again. Do you have a mingw version of the library? –  Mar 08 '13 at 23:47
  • Btw. you can compile it with mingw; this may help you: http://stackoverflow.com/questions/13280932/compiling-libnoise-on-windows-with-mingw –  Mar 08 '13 at 23:50