【发布时间】:2017-10-09 01:12:08
【问题描述】:
在解压后运行bootstrap.bat gcc 时,bootstrap.log 出现下一个错误:
...
\boost_1_65_1\tools\build\src\engine>.\bootstrap\jam0 -f build.jam
--toolset=gcc "--toolset-root= "
...found 161 targets...
...updating 3 targets...
[MKDIR] bin.ntx86_64
[COMPILE] bin.ntx86_64\b2.exe
debugger.c: In function 'debug_start_child':
debugger.c:1128:5: error:
'for' loop initial declarations are only allowed in C99 mode
for ( int i = 1; i < argc; ++i )
^
debugger.c:1128:5: note: use option -std=c99 or -std=gnu99 to compile your code
strings.c: In function 'string_rtrim':
strings.c:195:5: warning: ISO C90 forbids mixed declarations and code
[-Wpedantic]
char * p = self->value + self->size - 1;
^
...
修改boost_1_65_1\tools\build\src\engine\debugger.c:1128 我得到了正确的构建。
我将编译命令跟踪到boost_1_65_1\tools\build\src\engine\config_toolset.bat:204。所以通过添加--std=c99我也可以解决它(虽然我得到警告并且编译失败)。
我在https://svn.boost.org/trac10/search?ticket=on 没有找到报告。
有更多经验的人可以证实这一点吗?如有必要,请报告。
Windows 10 - 64 位。 Mingw-w64 (gcc 4.8.3)。 提升 1.65.1。
【问题讨论】:
-
Boost 是一个 C++ 的东西,你可能不应该尝试在 any中使用 C 编译器来编译它> 模式:-)
-
你是对的。但是我添加了 gcc 选项,因为这个 Windows 入门 (boost.org/doc/libs/1_62_0/more/getting_started/windows.html) 和这个 (gist.github.com/sim642/29caef3cc8afaa273ce6)。 gcc 工具集适用于 MinGW 和 Cygwin。
-
当前的 C 标准是 ISO/IEC 9899:2011,因此请尝试
--std=c11作为代码的 C 部分。如果可行,您可以提交构建脚本已损坏/旧的错误。