Libnoise不想编译:找不到-lnoise

时间:2018-05-24 16:54:46

标签: c++ makefile mingw noise

我正在尝试使用Libnoise库,我不断收到此错误:

F:\PortableApps\Documents\Adventure³>g++ Compiled/*.o -o Adventure3 -L./Libs -static -lglew32 -lglfw3dll -lopengl32 -lfreetype -lnoise -static-libgcc-static-libstdc++ Resources/icon.res
f:/portableapps/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lnoise
collect2.exe: error: ld returned 1 exit status

我的libnoise.lib文件夹中有Libs。我尝试使用-llibnoise代替,我得到了:

F:\PortableApps\Documents\Adventure³>g++ Compiled/*.o -o Adventure3  -L./Libs -static -lglew32 -lglfw3dll -lopengl32 -lfreetype -llibnoise -static-libgcc -static-libstdc++ Resources/icon.res
Compiled/Generator.o:Generator.cpp:(.text+0x3d): undefined reference to `noise::module::Perlin::GetValue(double, double, double) const'
Compiled/Generator.o:Generator.cpp:(.text+0x8a): undefined reference to `noise::module::Perlin::Perlin()'
Compiled/Generator.o:Generator.cpp:(.text$_ZN5noise6module6PerlinD1Ev[__ZN5noise6module6PerlinD1Ev]+0xa): undefined reference to `vtable for noise::module::Perlin'
Compiled/Generator.o:Generator.cpp:(.text$_ZN5noise6module6PerlinD1Ev[__ZN5noise6module6PerlinD1Ev]+0x19): undefined reference to `noise::module::Module::~Module()'
collect2.exe: error: ld returned 1 exit status

我不知道如何手动编译源代码,无论我尝试WinMain@16,它总是会返回make错误。

现在,我真的不知道该怎么做......

任何人都有解决方案吗?

1 个答案:

答案 0 :(得分:1)

gcc的

-l选项假设该库的名称以lib开头,因此-lnoise会链接libn​​oise。

通常.lib是一个导入库或静态库。与此处描述的导入库相关的问题:How do import libraries work and why doesn't MinGW need them?

关于libnoise:Netbeans C++ using MinGW and the libnoise library