Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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: _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

like image 596
Michael Eilers Smith Avatar asked Nov 22 '25 05:11

Michael Eilers Smith


1 Answers

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

like image 95
Steve Blackwell Avatar answered Nov 23 '25 20:11

Steve Blackwell