如何在 MACOSX 上将 GLUT 与 CUDA 结合使用?
我在 MacOsX 上编译使用 GLUT 的 CUDA 程序时遇到问题。这是我用来编译源代码的命令行:
nvcc main.c -o main -Xlinker "-L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL -lGLU" "-L/System/Library/Frameworks /GLUT.framework"
这是我得到的错误:
未定义的符号: “_glutInitWindowSize”,引用自: _main 在 tmpxft_00001612_00000000-1_main.o “_glutInitWindowPosition”,引用自: _main 在 tmpxft_00001612_00000000-1_main.o “_glutDisplayFunc”,引用自: _main 在 tmpxft_00001612_00000000-1_main.o “_glutInitDisplayMode”,引用自: _main 在 tmpxft_00001612_00000000-1_main.o “_glutCreateWindow”,引用自: _main 在 tmpxft_00001612_00000000-1_main.o “_glutMainLoop”,引用自: _main 在 tmpxft_00001612_00000000-1_main.o “_glutInit”,引用自: _main 在 tmpxft_00001612_00000000-1_main.o ld:未找到符号 collect2: ld returned 1 exit status
我知道我没有为 GLUT 指定任何库,但我就是找不到它!有人知道它在哪里吗?顺便说一句,用nvcc编译时似乎没有办法使用GLUT.framework。
非常感谢,
欧米伽泰
I'm having problems compiling a CUDA program that uses GLUT on MacOsX. Here is the command line I use to compile the source:
nvcc main.c -o main -Xlinker "-L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL -lGLU" "-L/System/Library/Frameworks/GLUT.framework"
And here is the errors I get:
Undefined symbols:
"_glutInitWindowSize", referenced from:
_main in tmpxft_00001612_00000000-1_main.o
"_glutInitWindowPosition", referenced from:
_main in tmpxft_00001612_00000000-1_main.o
"_glutDisplayFunc", referenced from:
_main in tmpxft_00001612_00000000-1_main.o
"_glutInitDisplayMode", referenced from:
_main in tmpxft_00001612_00000000-1_main.o
"_glutCreateWindow", referenced from:
_main in tmpxft_00001612_00000000-1_main.o
"_glutMainLoop", referenced from:
_main in tmpxft_00001612_00000000-1_main.o
"_glutInit", referenced from:
_main in tmpxft_00001612_00000000-1_main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I am aware that I haven't specified any lib for GLUT but I just can't find it! Does anybody know where it is? By the way, there doesn't seem to be a way to use the GLUT.framework when compiling with nvcc.
Thanks a lot,
omegatai
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
看起来您可能已经有了答案,但为了将来的参考,您
可以只使用而不是整体
在使用 nvcc 时 。来源:http://forums.nvidia.com/index.php?showtopic=163995
Looks like you probably already have your answer, but for future reference, you can just use
instead of the whole
when working with nvcc. Source: http://forums.nvidia.com/index.php?showtopic=163995
这是:
http://developer.apple.com/mac/库/samplecode/glut/index.html
Here it is:
http://developer.apple.com/mac/library/samplecode/glut/index.html
这些解决方案都不适合我。我需要的只是:
None of these solutions worked for me. What I needed was just: