0
我是新来的Visual Studio,我想在我的CUDA代码中使用cuPrintf使用Visual Studio的CUDA代码2010LNK2005错误,同时为cuPrintf
#include "cuPrintf.cu"
#include "cuPrintf.cuh"
,但我收到以下错误
gpuLBMSolver.cu.obj : error LNK2005: "int __cdecl cuPrintf(char const *)" ([email protected]@[email protected]) already defined in cuPrintf.cu.obj
1>gpuLBMSolver.cu.obj : error LNK2005: "void __cdecl cuPrintfRestrict(int,int)" ([email protected]@[email protected]) already defined in cuPrintf.cu.obj
1>gpuLBMSolver.cu.obj : error LNK2005: _cudaPrintfInit already defined in cuPrintf.cu.obj
1>gpuLBMSolver.cu.obj : error LNK2005: _cudaPrintfEnd already defined in cuPrintf.cu.obj
1>gpuLBMSolver.cu.obj : error LNK2005: _cudaPrintfDisplay already defined in cuPrintf.cu.obj
相同的代码我的Linux机器上工作正常... 在此先感谢
它不适用于我的代码...我仍然得到相同的错误... – amitdonanand
更新了我的答案。你正在做一个'#include“cuPrintf.cu”'在你的文件中,*和*你分别在你的项目中建立'cuPrintf.cu'。不要在你的项目中建立'cuPrintf.cu'。只是包括它。 –
谢谢,它的工作 – amitdonanand