我的 Irrlicht 程序无法链接。我使用的编译器是g++。
Code:
#include <irrlicht.h>
int main()
{
irr::IrrlichtDevice *device = irr::createDevice();
// And other init stuff
while(device->run())
{
driver->beginScene();
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
}
链接器输出:
...
(path)/main.cpp:28: undefined reference to `__imp_createDevice'
collect2.exe: error: ld returned 1 exit status
命令行:
g++.exe -o "(Path)\Test.exe" "(Path)\Test\main.o"
..\..\..\..\..\..\MinGW\lib\libIrrlicht.a
链接器创建库文件。怎么了?
编辑:
我做了很少的实验。结果当我评论的时候createDevice()
-line out,不会出现链接器错误。这意味着,该链接器找到了所有其他函数,即IrrlichtDevice::run()
.
__imp_createDevice 指的是为以下目的构建的 .lib 文件dynamic链接到 .so 或 .dll。请参阅此帖子并回答。 https://stackoverflow.com/questions/5159353/how-can-i-get-rid-of-the-imp-prefix-in-the-linker-in-vc
找到为静态链接构建的 .lib,或者检查是否必须指定预编译器定义(例如 _IRR_STATIC_LIB_、IRRLICHT_STATIC 或 IRRLICHT_EXPORTS)才能拥有正确的链接。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)