Protocol buffers PROTOBUF_INLINE_NOT_IN_头

Protocol buffers PROTOBUF_INLINE_NOT_IN_头,protocol-buffers,blockchain,Protocol Buffers,Blockchain,我正试图在Debian8上安装开源项目OpenTransactions。我已经安装了所有依赖项,在编译(make)时遇到问题。在我的终端上显示以下错误,尽管我已确保安装protobuf项目: In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:64:0, from /root/opentxs/src/core/OTStorage.cpp:47: /root

我正试图在Debian8上安装开源项目OpenTransactions。我已经安装了所有依赖项,在编译(make)时遇到问题。在我的终端上显示以下错误,尽管我已确保安装protobuf项目:

In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:64:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Generics.pb.h:501:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:65:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Markets.pb.h:2062:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:66:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Bitcoin.pb.h:833:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
In file included from /root/opentxs/src/../include/opentxs/core/OTStoragePB.hpp:67:0,
                 from /root/opentxs/src/core/OTStorage.cpp:47:
/root/opentxs/build/src/core/otprotob/Moneychanger.pb.h:1026:6: error: "PROTOBUF_INLINE_NOT_IN_HEADERS" is not defined [-Werror=undef]
 #if !PROTOBUF_INLINE_NOT_IN_HEADERS
      ^
cc1plus: all warnings being treated as errors
src/core/CMakeFiles/opentxs-core.dir/build.make:1368: recipe for target 'src/core/CMakeFiles/opentxs-core.dir/OTStorage.cpp.o' failed
make[2]: *** [src/core/CMakeFiles/opentxs-core.dir/OTStorage.cpp.o] Error 1
make[2]: Leaving directory '/root/opentxs/build'
CMakeFiles/Makefile2:586: recipe for target 'src/core/CMakeFiles/opentxs-core.dir/all' failed
make[1]: *** [src/core/CMakeFiles/opentxs-core.dir/all] Error 2
make[1]: Leaving directory '/root/opentxs/build'
Makefile:150: recipe for target 'all' failed
make: *** [all] Error 2

关于如何处理这个问题有什么想法吗?无法联机找到任何帮助。

通过在CMakelists.txt顶部添加这一行来修复此问题

add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)

我在Ubuntu 14.04上遇到了同样的问题,我按照你说的修复了它。但我写这封信只是为了进一步解释这个问题
所以,在谷歌搜索错误后,我发现了这个。他们描述的问题是谷歌编码器依赖于C++标准允许将未定义的预处理器符号视为0的事实。因此,有一堆if指令测试
PROTOBUF_INLINE_NOT_IN_HEADERS
的值,但它没有在任何地方定义;这是合法的,应该被视为零
我通过将
-DPROTOBUF_INLINE_NOT_IN_HEADERS=0
添加到顶级SConstruct中的CCFLAGS和src/SConscript(cxflags)中的cxflags(cxflags)中解决了这个问题,这似乎抓住了它

因此,要解决这个问题,您应该在opentxs主文件夹中找到的CMakeList.txt中添加这一行:

添加定义(-DPROTOBUF_INLINE_NOT_IN_HEADERS=0)

不要忘记重复
cmake
步骤

希望这是更清楚和有益的

即使“隐含0”的使用是正确的,检查也会在它是唯一条件的地方进行。因此,它可以写为
#ifndef
,不会丢失。可惜他们没有这么做。。。