Linking Classes: ptxas fatal : Unresolved extern function

Hi everyone,

i have a problem with a testproject with multiple classes. The project consists of a class line and a class dot. The class line has 2 dots and should use some functions of the class dot.

When it comes to the compile phase of the project i get the error:

Building NVCC (Device) object src/CMakeFiles/CU_FILES.dir//./CU_FILES_generated_Cu_Line.cu
“ptxas fatal : Unresolved extern function ‘ZN6Cu_Dot8distanceEPS’”

I´m including the header files of the class dot in the source file of the line class. I thought that the linker will link this “distance” function later in the Cu_Line sources.
Is there a way to get around this? The application is a cmake project but i don´t need it if there is another way around with this problem. The project is attached.

I hope someone has an idea.

My system:
Scientific Linux SL release 5.4
Tesla C2070
Cuda compilation tools, release 5.0
gcc-Version 4.1.2

TestLinkerProject.zip (75.3 KB)

Are you trying to take advantage of the separate compilation feature of CUDA 5.0?

I haven’t implemented direct support for separate compilation yet for CMake.

You might be able to try it with a couple of modifications.

Add –arch=sm_20 –dc to your CUDA_NVCC_FLAGS. This will instruct nvcc to turn on separate compilation.

Second, you need to add a new custom build rule to link all the cuda code into a single object file. Give me a bit, and I can cook one up for you.

I still have this problem. Can anyone help?

you may need to build with separable compilation and device linking

if in CMake just google

cmake cuda separable compilation