编译Qt应用程序时,架构x86_64错误的重复符号

Lah*_*ima 5 c++ macos qt

我正在尝试使用Qt creator在osx上编译Qt应用程序.应用程序成功编译为寡妇.但在mac中,它会产生以下链接器错误.

2 duplicate symbols for architecture x86_64
linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

有没有人知道检查链接器抱怨的重复符号的方法?我在.pro文件中使用了以下但没有成功.

QMAKE_LFLAGS += -v
Run Code Online (Sandbox Code Playgroud)

Lah*_*ima 7

由N1ghtLight发表评论作为答案.

Duplicate symbols founderror是一个链接器错误,它表示链接器找到了多个具有相同名称的符号.以下是一些常见原因.

  • 您已在头文件(类外)中编写了函数定义,该文件包含在两个或多个cpp文件中.
  • 您已经定义了两次静态变量.
  • 您已在cpp文件中编写了两次函数定义.

您可以通过选中Compile Output标签来查找重复符号是什么Qt Creator