Pro*_*mer 2 cuda gpu gpgpu nvidia gpu-programming
我正在尝试编写一个有人发给我的cuda项目.虽然编译阶段通过,但链接阶段失败.以下是错误的示例:
Error 298 error LNK2005: "int __cdecl compare_ints(void const *,void const *)" (?compare_ints@@YAHPBX0@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj
Run Code Online (Sandbox Code Playgroud)
基本上,文件decode_p4.cu.obj抱怨函数compare_ints已在3level_1.cu.obj中定义.关于如何避免这种行为的任何想法?
如果有帮助,下面是类似错误的列表:
Error 384 error LNK2005: "int __cdecl compare_ints(void const *,void const *)" (?compare_ints@@YAHPBX0@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 385 error LNK2005: "int __cdecl cpu_intersection(unsigned int *,int,unsigned int *,int)" (?cpu_intersection@@YAHPAIH0H@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 386 error LNK2005: "int __cdecl intersection_cpu(unsigned int * * const,int * const,int)" (?intersection_cpu@@YAHQAPAIQAHH@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 387 error LNK2005: "void __cdecl sort_it(unsigned int * * const,int * const,int)" (?sort_it@@YAXQAPAIQAHH@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 388 error LNK2005: "int __cdecl GPU_Intersection(unsigned int * * const,int * const,int,unsigned int *,unsigned int *,unsigned int *,struct uint4 *)" (?GPU_Intersection@@YAHQAPAIQAHHPAI22PAUuint4@@@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 389 error LNK2005: "int __cdecl ceilPow2(int)" (?ceilPow2@@YAHH@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 390 error LNK2005: "void __cdecl recAllocate1(int,int)" (?recAllocate1@@YAXHH@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 391 error LNK2005: "unsigned int __cdecl getceilPow2(unsigned int)" (?getceilPow2@@YAII@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 392 error LNK2005: "void __cdecl runTest(int,char * *)" (?runTest@@YAXHPAPAD@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 393 error LNK2005: "void __cdecl __device_stub__Z13scanBlockMAX1P5uint4S0_Pj(struct uint4 *,struct uint4 *,unsigned int *)" (?__device_stub__Z13scanBlockMAX1P5uint4S0_Pj@@YAXPAUuint4@@0PAI@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 394 error LNK2005: "void __cdecl scanBlockMAX1(struct uint4 *,struct uint4 *,unsigned int *)" (?scanBlockMAX1@@YAXPAUuint4@@0PAI@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Error 395 error LNK2005: "void __cdecl __device_stub__Z16scanBlockMAX1_gpP5uint4S0_Pj(struct uint4 *,struct uint4 *,unsigned int *)" (?__device_stub__Z16scanBlockMAX1_gpP5uint4S0_Pj@@YAXPAUuint4@@0PAI@Z) already defined in 3level_1.cu.obj decode_p4.cu.obj god
Run Code Online (Sandbox Code Playgroud)
这只是一个猜测,但如果这是visual studio,我之前已经看到过这种情况,因为代码在.inc文件中是#included.在这种情况下,它也不应该编译为源文件.要避免这种情况,请右键单击其中一个文件(很难说明您的描述中的内容)并选择属性,然后查找并选中"从构建中排除"复选框.
| 归档时间: |
|
| 查看次数: |
3140 次 |
| 最近记录: |