c++ - GCC "bailing out"在给出重新声明错误后定义的位置和以前定义的位置是否相同?

标签 c++ linux gcc g++

我收到以下错误:

In file included from generated/tandembiginteger.cpp:2:
generated/tandembiginteger.h:26: error: redefinition of `const int tandem::TandemMessageType_TandemBigInteger'
generated/tandembiginteger.h:26: error: `const int tandem::TandemMessageType_TandemBigInteger' previously defined here
generated/tandembiginteger.h:26: confused by earlier errors, bailing out

如您所见,重新声明和“先前”声明的地方是相同的。这是什么错误?如何解决?

最佳答案

我认为你只需要使用 include 守卫。

这里有关于 SO 的讨论:#pragma once vs include guards?

关于c++ - GCC "bailing out"在给出重新声明错误后定义的位置和以前定义的位置是否相同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20348618/

相关文章:

objective-c - clang 编译器从相同的来源生成不同的目标文件

linux - 在 Linux 上使用 gcc 进行增量链接。可能吗?

c++ - 如何在 SDL2 文本输入中禁用按键重复

c++ - 将 char 数组连接在一起

linux - UDP 数据包丢弃 - INErrors 与 .RcvbufErrors

c - 如何编译GCC交叉编译器?

c++ - 迭代计数器不递增

c++ - CRLF 行尾和 ostringstream

Linux 看门狗和 NTP

java - 如何在 Linux 中删除/tmp/.java_pid<number> 文件?