在使用了其他语言(如C++和Java )之后,我已经使用D大约一个月了。我一直想将我的简单游戏平台从Java移到D,我想使用Derelict3库来实现这一点。我已经编译了位于这里的github存储库https://github.com/aldacron/Derelict3
运行Linux,如果有帮助的话。
我将我的.a文件放置在/usr/lib/.中,并将.a文件(从废弃根目录导入的文件夹)放置在中
我的代码如下:
import std.stdio;
import derelict.opengl3.gl3;
import derelict.glfw3.glfw3;
pragma(lib, "/usr/lib/libDerelictUtil.a");
pragma(lib, "/usr/lib/libDerelictGL3.a");
pragma(lib, "/usr/lib/libDerelictGLFW3.a");
void main() {
DerelictGL3.load();
writeln("This is a line");
}这是基于在堆栈溢出和dlang.org论坛中的一些主题上回答的其他问题,但是终端在我编译时向我吐露了这一点:
kevin@kevin-Latitude-D620:~$ dmd main.d
/usr/include/D/Derelict/libDerelictGL3.a(gl3.o): In function `_D8derelict7opengl33gl318_sharedStaticDtor2FZv':
../import/derelict/opengl3/gl3.d:(.text._D8derelict7opengl33gl318_sharedStaticDtor2FZv+0x4): undefined reference to `_D8derelict4util6loader15SharedLibLoader19isAutoUnloadEnabledOFNdZb'
/usr/include/D/Derelict/libDerelictGL3.a(gl3_d1_649.o):(.data+0x38): undefined reference to `_D8derelict4util6loader15SharedLibLoader7__ClassZ'
/usr/include/D/Derelict/libDerelictGL3.a(gl3_d1_649.o):(.rodata+0x4418): undefined reference to `_D8derelict4util6loader15SharedLibLoader4loadMFZv'
(MORE of the above)
collect2: ld returned 1 exit status
--- errorlevel 1发布于 2012-05-14 17:31:38
当链接器首先通过库进行链接时,链接器会维护一个未解析符号列表,试图减少未解析的列表。这意味着任何依赖项都应该在依赖于它们的代码之后列出。所以试着重新安排你的语用(libs.)就像这样:
pragma(lib, "DerelictGL3");
pragma(lib, "DerelictGLFW3");
pragma(lib, "DerelictUtil");
pragma(lib, "dl");https://stackoverflow.com/questions/10564608
复制相似问题