「リンクエラーLNK2005 ...既に定義されています」というエラーが発生しました。以下のようにファイルは、次のとおりです。リンクエラーLNK2005複数のCUDAファイル
// File Bitmap4.cu
#include "Bitmap4.h" // header
#include "Bitmaps_cuda.h" // header with just the definitions of the kernels
..... // I call 3+2 kernel functions (3 in one method, 1 in another and 1 in another one)
は、その後、私はこの1つ持っている:
// File Bitmap8.cu
#include "Bitmap8.h" // header
#include "Bitmaps_cuda.h" // the same as above
..... // I call 4 kernel functions (4 in the same method)
をそれから私は、カーネルヘッダがあります。
#ifndef __BITMAPS_KERNEL__
#define __BITMAPS_KERNEL__
...... // 9 kernels definitions
#endif
をそして最後に、私はこの1つ持っている:
を問題は、もし私が 'ビットマップ* .cuの1つに#include "Bitmaps_cuda.h"を含めてください。もちろん、コンパイラはカーネル関数の定義を見落としていると言います。私はたくさんの投稿を読んでいました。私はすでに「追加の異性」と必要なPATHを含んでいました。この問題は、相対的なカーネルでファイルBitmap8.cuを追加したときに始まりました。その前に、アプリケーションが正しく動作していたからです。
1>Bitmap8.cu.obj : error LNK2005: "void * __cdecl big_random_block(int([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "int * __cdecl big_random_block_int(int([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "unsigned char __cdecl value(float,float,int([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void * __cdecl start_thread(unsigned int(__stdcall*)(void *),void *)" ([email protected]@[email protected]@Z) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void __cdecl end_thread(void *)"([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void __cdecl destroy_thread(void *)"([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void __cdecl wait_for_threads(void * const *,int)"([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void __cdecl__device_stub__Z14float_to_colorPhPKf(unsigned char *,float const *)"([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void __cdecl float_to_color(unsigned char *,float_const *)" ([email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void __cdecl__device_stub__Z14float_to_colorP6uchar4PKf(struct uchar4 *,float const *)"([email protected]@[email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>Bitmap8.cu.obj : error LNK2005: "void __cdecl float_to_color(struct uchar4 *,float_const *)" ([email protected]@[email protected]@[email protected]) already defined in Bitmap4.cu.obj
1>C:\Users\dberdin\documents\visual studio 2010\Projects\gpuSPAM\Debug\gpuSPAM.exe : fatal error LNK1169: one or more multiply defined symbols found
私はさまざまなソリューションを試みたが、いずれかの結果で:
はとにかく、それらは私が持っているエラーです。
ありがとうございます! - 絶対値をそれぞれ定義で異なる値と、二重に定義して
:
ウェブサイト(http://msdn.microsoft.com/en-us/library/72zdcz6f.aspx)で
EDIT私はこれらのエラーの原因の一つであることを見出しました。
実際、私が下に書いたように、私はこの種の定義を持っていますが、私は違うことはできません。どのようにそれを解決するための任意のアイデア?
はあなたが9つのカーネルの宣言ではなく、定義を持っていると言うことを意味していましたか?事前に再び
私はヘッダーファイルを2回追加しました!問題が解決しました! – davideberdin