Hi,
I’m developing a CUDA library with the biggest part written in C++. To test this library I have created a second project that uses this CUDA library. The library project compiles correctly, but as soon as I want to use it within the console test application I get a linker error that a function is not found.
I’m using Microsoft Visual C++ 2008 Express Edition with the CUDA Wizard installed.
The error:
error LNK2019: unresolved external symbol _smithwatermancuda referenced in function "public: void __thiscall SmithWatermanCUDA::run(void)" (?run@SmithWatermanCUDA@@QAEXXZ)
The library (so far) is basicly one class which calls a CUDA kernel from the run() function.
Some code snippets from the library project:
smithwaterman.cpp
#include "smithwatermancuda.h"
extern "C" void smithwatermancuda();
void SmithWatermanCUDA::run()
{
smithwatermancuda();
}
smithwaterman.cu
#include "smithwatermancuda_kernel.cu"
extern "C" void smithwatermancuda()
{
dim3 grid(1, 1, 1);
dim3 threads(10, 1, 1);
smithwatermancuda_kernel<<< grid, threads >>>();
}
smithwatermancuda_kernel.cu
#ifndef SMITHWATERMANCUDA_KERNEL_H
#define SMITHWATERMANCUDA_KERNEL_H
__global__ void smithwatermancuda_kernel()
{
}
#endif // SMITHWATERMANCUDA_KERNEL_H
So the library project builds correctly, but as soon as being used in a different application the linker error occurs.
I’ve attached the whole solution to this post.
Hopefuly somebody could explain what goes wrong.
Cheers,
Frank
CUDA_C___Test.rar (9.9 KB)