How can I use GLUT with CUDA on MACOSX?
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: _开发者_JAVA技巧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
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. Source: http://forums.nvidia.com/index.php?showtopic=163995
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:
-framework GLUT -framework openGL -lGLEW
精彩评论