【问题标题】:Libnoise don't want to compile: Cannot find -lnoiseLibnoise 不想编译:找不到 -lnoise
【发布时间】:2018-11-03 23:40:39
【问题描述】:

我正在尝试使用 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

我的Libs 文件夹中有libnoise.lib。我尝试改用-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

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

谁有解决办法?

【问题讨论】:

    标签: c++ makefile mingw noise


    【解决方案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

    【讨论】:

    • @Trytio 你也是怎么链接的呢?它的格式与您的编译器兼容吗?
    • 我不知道 lib 有特定的格式。我怎么知道格式?
    • 好的,我终于找到了如何使用您给我的链接进行编译。不幸的是,当我做-lnoise时,我仍然有第二个消息错误...
    • 我发现了问题,是因为我不能用mingw编译.so。
    猜你喜欢
    • 2014-10-22
    • 1970-01-01
    • 1970-01-01
    • 2016-12-12
    • 2015-06-27
    • 2019-01-24
    • 2012-01-14
    • 2023-03-05
    相关资源
    最近更新 更多