gpt4 book ai didi

c++ - boost::process 在 Cygwin 中不起作用

转载 作者:行者123 更新时间:2023-11-30 05:00:29 24 4
gpt4 key购买 nike

尝试在Cygwin环境下编译以下代码:

#include <boost/process.hpp>

int main() { }

并得到以下错误:

In file included from /usr/include/boost/process/detail/child_decl.hpp:31:0,
from /usr/include/boost/process/child.hpp:21,
from /usr/include/boost/process/async_system.hpp:22,
from /usr/include/boost/process.hpp:24,
from bp.cpp:2:
/usr/include/boost/process/detail/posix/is_running.hpp:18:1: error: non-constant condition for static assertion
static_assert(!WIFEXITED(still_active), "Internal Error");
^~~~~~~~~~~~~
In file included from /usr/include/cygwin/stdlib.h:13:0,
from /usr/include/stdlib.h:26,
from /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/cstdlib:75,
from /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/ext/string_conversions.h:41,
from /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/bits/basic_string.h:6349,
from /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/string:52,
from /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/stdexcept:39,
from /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/system_error:41,
from /usr/include/boost/process/detail/config.hpp:21,
from /usr/include/boost/process/detail/basic_cmd.hpp:10,
from /usr/include/boost/process/args.hpp:33,
from /usr/include/boost/process.hpp:22,
from bp.cpp:2:
/usr/include/boost/process/detail/posix/is_running.hpp:18:16: error: call to non-constexpr function 'int __wait_status_to_int(int)'
static_assert(!WIFEXITED(still_active), "Internal Error");
^

你能建议如何修复它吗?

我正在使用 Boost 1.66。

最佳答案

WIFEXITED 宏扩展为对 __wait_status_to_int 的函数调用。这个不能在编译时调用。

这是 Cygwin 中 boost process 的错误。

根据

https://github.com/openunix/cygwin/blob/master/winsup/cygwin/include/sys/wait.h

__wait_status_to_int 是一个宏,对于 C++,它们删除了宏,而是提供了两个重载函数。

关于c++ - boost::process 在 Cygwin 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50760411/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com