Search code examples
openglcudaunresolved-external

Unresolved External Symbol for gluPerspective in CUDA project


Actually, I know it's a popular linking problem, which regularly can be resolved by adding #pragma(lib, "glu32.lib") or adding glu32.lib in Visual studio configuration.

However, my problem is strange and solutions above is useless.

I added some extra files containing OpenGL functions like gluPerspective and gluBuild2DMipmaps to the CUDA project, the VolumeRender, which is from CUDA SDK.

After compiling, I found those extra files would occur the Unresolved External Symbol error for glu functions. However, when I put these glu functions into the original Cpp file, it works fine.

I have ever tried two solutions above but useless. Could anyone give me a hint to solve this puzzle?


Solution

  • Finally I gave up. I tried to add the CUDA part into the OpenGL projects. It worked fine!