Call CUDA from C++ Linking problems with calling CUDA from C++

Im having problems with calling CUDA from C++ and linking.

Im using VS2010 with the tools provided here http://forums.nvidia.com/index.php?showtopic=161096.

When I try to compile i get a linking error.

CUDA_Over.obj : error LNK2019: unresolved external symbol _PreOver_CUDAKernel referenced in function “void __cdecl PreOver_CUDA(void *,void const *,void const *,unsigned int)” (?PreOver_CUDA@@YAXPAXPBX1I@Z)

CUDA_Over.hpp

CUDA_Over.cpp

#include "..\..\StdAfx.h"

#include "CUDA_Over.hpp"

extern "C" void PreOver_CUDAKernel(void*, const void*, const void*, size_t);

void PreOver_CUDA(void* h_dest, const void* h_source1, const void* h_source2, size_t size)

{

	PreOver_CUDAKernel(h_dest, h_source1, h_source2, size);

}

CUDA_OverKernel.cu

#include <stdio.h>

#include <assert.h>

#include <cuda.h>

__global__ void PreOver_GPUKernel(int* dest, int* source1, int* source2)

{

}

extern "C" void PreOver_CUDAKernel(void* h_dest, const void* h_source1, const void* h_source2, size_t size)

{

}

server.vxproj (I have removed alot of unnecessary nodes to reduce size)

i changed to runtime instead of driver in the project settings. Still the same problem though.

No one has any idea as to what might be causing this?

Hi Nagy

I got the sam eproblem but with C not C++.
My main function in C file (main.c)
My call kernal function is in cu (CallKernel.cu)

tried extern but doesnt work.

Did you sort out this? if yes can you please share it.

Thanks
Hus