特別なファイルを定義しました:config.h
私のプロジェクトにはファイルもあります:
t.c, t.h
pp.c, pp.h
b.c b.h
l.cpp
および #includes:
で:
#include "t.h"
#include "b.h"
#include "pp.h"
#include "config.h"
紀元前:
#include "b.h"
#include "pp.h"
pp.cで:
#include "pp.h"
#include "config.h"
l.cpp:
#include "pp.h"
#include "t.h"
#include "config.h"
私のファイルには include ディレクティブはありません。ファイル*.h
のみ*.c
です。これをconfig.hで定義しました:
const char *names[i] =
{
"brian", "stefan", "steve"
};
l.cpp、tc、pp.cでその配列が必要ですが、次のエラーが発生します:
pp.o:(.data+0x0): multiple definition of `names'
l.o:(.data+0x0): first defined here
t.o:(.data+0x0): multiple definition of `names'
l.o:(.data+0x0): first defined here
collect2: ld returned 1 exit status
make: *** [link] Error 1
プロジェクトで使用するすべての*.h
ファイルにガードを含めています。これを解決する助けはありますか?