当前位置:  开发笔记 > 运维 > 正文

PROTOBUF_INLINE_NOT_IN_HEADERS

如何解决《PROTOBUF_INLINE_NOT_IN_HEADERS》经验,为你挑选了1个好方法。

我正在尝试在debian 8上安装Open Transactions,这是一个开源项目.我已经安装了所有的依赖项,并且在编译(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

关于如何处理这个问题的任何想法?在网上找不到任何帮助.



1> jemacom..:

我在Ubuntu 14.04上遇到了同样的问题,我正如你所说的那样修复它.但我只是写信来解释更多问题.
所以,谷歌搜索错误后我发现了这个讨论 .他们描述了这个问题是因为谷歌程序员依赖于这样一个事实,即C++标准允许你将未定义的预处理器符号视为评估为0.所以有一堆#if指令测试其值PROTOBUF_INLINE_NOT_IN_HEADERS什么时候没有定义; 这是合法的,应该被视为零.
我通过添加-DPROTOBUF_INLINE_NOT_IN_HEADERS=0到顶级SConstruct中的CCFLAGS和src/SConscript(CXXFLAGS)中的CXXFLAGS来修复此问题,这似乎抓住了它.

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

add_definitions(-DPROTOBUF_INLINE_NOT_IN_HEADERS = 0)

别忘了重复这cmake一步.

希望这更清楚,更有帮助.

推荐阅读
周扒pi
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有