tags:

views:

231

answers:

3

Hi,

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

A: 

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

stevehb
Yeah, this is what worked for me. I didn't think Xlinker would work for nvcc, but I guess it works in parallel with gcc, so yeah. Thanks a lot everyone and sorry for the delay.
omegatai
A: 

None of these solutions worked for me. What I needed was just:

-framework GLUT -framework openGL -lGLEW
Meekohi