简体   繁体   English

如何在MACOSX上使用GLUT和CUDA?

[英]How can I use GLUT with CUDA on MACOSX?

I'm having problems compiling a CUDA program that uses GLUT on MacOsX. 我在编译在MacOsX上使用GLUT的CUDA程序时遇到问题。 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" 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 未定义的符号:“_ glutInitWindowSize”,引用自:_mp in tmpxft_00001612_00000000-1_main.o“_glutInitWindowPosition”,引自:_mp in tmpxft_00001612_00000000-1_main.o“_glutDisplayFunc”,引自:_mp in tmpxft_00001612_00000000-1_main.o“_glutInitDisplayMode”,引用from:_main in tmpxft_00001612_00000000-1_main.o“_glutCreateWindow”,引用自:_mp in tmpxft_00001612_00000000-1_main.o“_glutMainLoop”,引自:_mp in tmpxft_00001612_00000000-1_main.o“_glutInit”,引自:tmpxft_00001612_00000000-1_main中的_main。 o ld:未找到符号collect2:ld返回1退出状态

I am aware that I haven't specified any lib for GLUT but I just can't find it! 我知道我没有为GLUT指定任何lib,但我找不到它! 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. 顺便说一句,在使用nvcc进行编译时似乎没有办法使用GLUT.framework。

Thanks a lot, 非常感谢,

omegatai omegatai

Looks like you probably already have your answer, but for future reference, you can just use 看起来您可能已经有了答案,但为了将来参考,您可以使用

-Xlinker -framework,OpenGL,-framework,GLUT

instead of the whole 而不是整体

-L/System/Library/Frameworks/OpenGL.framework/Libraries -lGL -lGLU

when working with nvcc. 使用nvcc时。 Source: http://forums.nvidia.com/index.php?showtopic=163995 资料来源: http//forums.nvidia.com/index.php?showtopic = 163995

None of these solutions worked for me. 这些解决方案都不适合我。 What I needed was just: 我需要的只是:

-framework GLUT -framework openGL -lGLEW

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM