简体   繁体   English

使用MinGW和libnoise库的Netbeans C ++

[英]Netbeans C++ using MinGW and the libnoise library

Using netbeans 7.2 and the most recent version of MinGW (using installer) I can't use the libnoise library. 使用netbeans 7.2和MinGW的最新版本(使用安装程序),我不能使用libnoise库。 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. 有一个.lib文件和.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. 我尝试了将它们添加到“项目”>“属性”>“构建”>“链接器”下以及将.dll放入基础项目目录中的所有可能组合。 Despite all this I am still getting undefined reference errors whenever I try and run the code. 尽管有所有这些,但是每次尝试运行代码时,我仍然会收到未定义的参考错误。 Does anyone know what to do? 有谁知道该怎么办?

I know that it is possible to link import library files (*.lib) with MinGW, but I still suggest to recompile libnoise. 我知道可以将导入库文件(* .lib)与MinGW链接在一起,但我仍然建议重新编译libnoise。

With the current Makefile, this is not very easy and may break. 使用当前的Makefile,这不是很容易,并且可能会中断。 Thus I've written a CMake script, which doesn't only work on Windows, but should work on all CMake supported platforms. 因此,我编写了一个CMake脚本,该脚本不仅在Windows上运行,而且在所有CMake支持的平台上都可以运行。 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 GitHub上的libnoise

After you've built your shared library, you'll have a libnoise.dll.a and libnoise.dll file. 构建共享库后,将有一个libnoise.dll.alibnoise.dll文件。 You then add libnoise.dll.a to the linking settings and put the DLL itself next to the binary, or in the working directory. 然后,您将libnoise.dll.a添加到链接设置中,并将DLL本身放在二进制文件旁边或工作目录中。

You have to link the lib file (= adding it to linker libraries) and put the dll to 您必须链接lib文件(=将其添加到链接器库)并将dll放入

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

(where your exe is put to). (将您的exe放在其中)。 There's no need to add the dll to linker too. 也无需将dll添加到链接器。

Can you please post the error message you get? 您能否发布您收到的错误消息?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM