XCode 链接器错误 1 ​​- 全局数组错误?

XCode Linker Error 1 - Global Array Error?

我在 Visual Studio 13 年写了一个 C++ Projekt,现在我想在 mac 上编译它。 在我检查了我的代码之后,我现在得到一个链接器错误 1,其规范为:

ld:6 个重复的建筑符号 x86_64 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

在上面我可以看到我创建的一些文件,比如 Listener.o 和 main.o

我看了一下,似乎全局数组是问题所在,但我不知道为什么,因为我只在 headers 中声明了数组,没有在其中定义...

好的,让我们看一下代码。

Listener.h

#include main.h
int checkMouseDown[8];
int ShakerToogled;
class definition...

Listener.cpp

#include main.h

... update the Variables and create them...

Shaker.h

float intValue[16][10];
int SenderToogled;

Shaker.cpp

#include main.h

... update the Variables and create them...

main.c

#include Listener.h
#include shaker.h

do something... with the global arrays

希望我能解释我的问题,你会有所帮助。

此致

PS:错误仅在 Mac 上,而不是在 Windows 中的 Visual Studio 中...

收到错误,已将文件更改为:

在Shaker.h

extern int checkMouseDown[8];

在Shaker.cpp

int checkMouseDown[8];

现在工作 ;)