Hello there,
I have installed CUDA 4.0 RC2 on my workstation but I have some trouble to build my project; for some reason I cannot call functions that are defined in cu file from cpp file (project is setted to /CRL because I need interoperability between .NET and CUDA but seem that doesn’t work any more… or have I missed something??).
I have used, as ever, extern “C” in cu file for my host function and extern “C” in cpp file to call it from a C++/CLI code; this is my sample (I have cleaned up it a little):
CudaDOG.cpp
#include "stdafx.h"
#include <stdlib.h>
#include "CudaDOG.h"
extern "C" void HostDOG(float *, float, float);
using namespace Cuda;
CudaDOG::CudaDOG()
{
};
CudaDOG::CudaDOG(float* image, float sigma1, float sigma2)
{
};
void CudaDOG::Run()
{
HostDOG(nullptr, 0, 0);
};
CudaDOG.cu
#include "CudaDOG.cuh"
extern "C"
void HostDOG(float* image, float sigma1, float sigma2)
{
};
And these are errors:
Error 1 error LNK2028: unresolved token (0A00000A) “extern “C” void __cdecl HostDOG(float *,float,float)” (?HostDOG@@$$J0YAXPEAMMM@Z) referenced in function “void __cdecl Test(void)” (?Test@@$$FYAXXZ) C:\Users\Paolo\Desktop\Thesis\VisualStudio\CUDA\CudaDOG\CudaDOG.obj CudaDOG
Error 2 error LNK2019: unresolved external symbol “extern “C” void __cdecl HostDOG(float *,float,float)” (?HostDOG@@$$J0YAXPEAMMM@Z) referenced in function “void __cdecl Test(void)” (?Test@@$$FYAXXZ) C:\Users\Paolo\Desktop\Thesis\VisualStudio\CUDA\CudaDOG\CudaDOG.obj CudaDOG
Error 3 error LNK1120: 2 unresolved externals C:\Users\Paolo\Desktop\Thesis\VisualStudio\CUDA\x64\Debug\CudaDOG.dll 1 1 CudaDOG
I really cannot figure out, what is wrong in my code?? It is “like” cppIntegration example in NVIDIA GPU Computing SDK 4.0.
Thanks for any help!!
Cheers