链接到 D 中的 libglut.a 时遇到问题

发布于 2024-10-09 08:19:06 字数 1175 浏览 1 评论 0原文

我有一个简单的 openGL D 程序可以编译,但我无法让它与 libglut.a 链接。我尝试了几种不同的命令行:

$ dmd life.d -lglut
$ dmd life.d -L-lglut
$ dmd life.d -L/usr/lib/libglut.a
$ dmd life.d /usr/lib/libglut.a

所有这些都会打印以下错误:

life.o:(.data+0x10): undefined reference to `_D1c2gl4glut12__ModuleInfoZ'
life.o:(.data+0x14): undefined reference to `_D1c2gl2gl12__ModuleInfoZ'
life.o: In function `_Dmain':
life.d:(.text._Dmain+0x72): undefined reference to `_D1c2gl4glut8glutInitT1c2gl4glut10pfglutInit'
life.d:(.text._Dmain+0x87): undefined reference to `_D1c2gl4glut19glutInitDisplayModeT1c2gl4glut21pfglutInitDisplayMode'
life.d:(.text._Dmain+0xa1): undefined reference to `_D1c2gl4glut18glutInitWindowSizeT1c2gl4glut20pfglutInitWindowSize'
life.d:(.text._Dmain+0xc2): undefined reference to `_D1c2gl4glut16glutCreateWindowT1c2gl4glut18pfglutCreateWindow'
life.d:(.text._Dmain+0xd7): undefined reference to `_D1c2gl4glut15glutDisplayFuncT1c2gl4glut17pfglutDisplayFunc'
life.d:(.text._Dmain+0xe6): undefined reference to `_D1c2gl4glut12glutMainLoopT1c2gl4glut14pfglutMainLoop'
collect2: ld returned 1 exit status
--- errorlevel 1

我的命令行有问题吗,还是其他问题?

I have a simple openGL D program that compiles, but I can't get it to link with libglut.a. I've tried a few different command lines:

$ dmd life.d -lglut
$ dmd life.d -L-lglut
$ dmd life.d -L/usr/lib/libglut.a
$ dmd life.d /usr/lib/libglut.a

All of these print the following errors:

life.o:(.data+0x10): undefined reference to `_D1c2gl4glut12__ModuleInfoZ'
life.o:(.data+0x14): undefined reference to `_D1c2gl2gl12__ModuleInfoZ'
life.o: In function `_Dmain':
life.d:(.text._Dmain+0x72): undefined reference to `_D1c2gl4glut8glutInitT1c2gl4glut10pfglutInit'
life.d:(.text._Dmain+0x87): undefined reference to `_D1c2gl4glut19glutInitDisplayModeT1c2gl4glut21pfglutInitDisplayMode'
life.d:(.text._Dmain+0xa1): undefined reference to `_D1c2gl4glut18glutInitWindowSizeT1c2gl4glut20pfglutInitWindowSize'
life.d:(.text._Dmain+0xc2): undefined reference to `_D1c2gl4glut16glutCreateWindowT1c2gl4glut18pfglutCreateWindow'
life.d:(.text._Dmain+0xd7): undefined reference to `_D1c2gl4glut15glutDisplayFuncT1c2gl4glut17pfglutDisplayFunc'
life.d:(.text._Dmain+0xe6): undefined reference to `_D1c2gl4glut12glutMainLoopT1c2gl4glut14pfglutMainLoop'
collect2: ld returned 1 exit status
--- errorlevel 1

Is there a problem with my command lines, or is it something else?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半暖夏伤 2024-10-16 08:19:06

这些看起来像是 D 代码中损坏的符号。您在上一个问题中提到您正在使用某种兼容层 - 您是否确保在构建中包含其中的文件或库?

Those look like mangled symbols from D code. You mentioned on your previous question that you were using some kind of compatibility layer – did you make sure to include the files or libraries from that in your build?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文