hello guys:
I write some codes with CUDA recently, and I want to track the variables on the GPU, so I download and attempt to use cuPrintf. but I received some linking error as following:
1>------ å·²å¯åŠ¨å…¨éƒ¨é‡æ–°ç”Ÿæˆ: 项目: Demo1, é…ç½®: Debug Win32 ------
1>æ£åœ¨åˆ 除项目“Demo1â€(é…置“Debug|Win32â€)çš„
ä¸é—´æ–‡ä»¶å’Œè¾“出文件
1>Compiling…
1>cuPrintf.cu
1>e:/cuPrintf/Demo1/cuPrintf_Lib//cuPrintf.cu(309): warning: function “copyArg(char *, const char *, char *)” was declared but never referenced
1>tmpxft_00000d70_00000000-3_cuPrintf.cudafe1.gpu
1>tmpxft_00000d70_00000000-8_cuPrintf.cudafe2.gpu
1>e:/cuPrintf/Demo1/cuPrintf_Lib//cuPrintf.cu(309): warning: function “copyArg(char *, const char *, char *)” was declared but never referenced
1>tmpxft_00000d70_00000000-3_cuPrintf.cudafe1.cpp
1>tmpxft_00000d70_00000000-12_cuPrintf.ii
1>Compiling…
1>main.cu
1>tmpxft_00000e38_00000000-3_main.cudafe1.gpu
1>tmpxft_00000e38_00000000-8_main.cudafe2.gpu
1>tmpxft_00000e38_00000000-3_main.cudafe1.cpp
1>tmpxft_00000e38_00000000-12_main.ii
1>æ£åœ¨é“¾æŽ¥…
1>cuPrintf.obj : error LNK2005: _cudaPrintfInit å·²ç»åœ¨ main.obj ä¸å®šä¹‰
1>cuPrintf.obj : error LNK2005: _cudaPrintfEnd å·²ç»åœ¨ main.obj ä¸å®šä¹‰
1>cuPrintf.obj : error LNK2005: _cudaPrintfDisplay å·²ç»åœ¨ main.obj ä¸å®šä¹‰
1>E:\cuPrintf\Debug\Demo1.exe : fatal error LNK1169: 找到一个或多个多é‡å®šä¹‰çš„符å·
1>ç”Ÿæˆæ—¥å¿—ä¿å˜åœ¨â€œfile://e:\cuPrintf\Demo1\Debug\BuildLog.htmâ€
1>Demo1 - 4 个error,2 个warning
========== å…¨éƒ¨é‡æ–°ç”Ÿæˆ: 0 å·²æˆåŠŸ, 1 已失败, 0 已跳过 ==========
The sample codes I used are from Jeremy Kemp(http://www.jeremykemp.co.uk/08/02/2010/cuda-cuprintf/),
#include <cuda.h>
#include “cuPrintf_Lib\cuPrintf.cu”
global void cuPrintfExample()
{
int tid;
tid = blockIdx.x * blockDim.x + threadIdx.x;
cuPrintf("%d\n", tid);
}
int main()
{
cudaPrintfInit();
cuPrintfExample <<< 5, 2 >>> ();
cudaPrintfDisplay(stdout, true);
cudaPrintfEnd();
return 0;
}
and I pasted them into a new source file named main.cu, so there are 3 files in my project, cuPrintf.cuh + cuPrintf.cu + main.cu, when I compiled it with VS2005 + CUDA2.3, such linking errors occurred.
would you please give me some advices ? thank you all !!