将代码升级到更高版本的 cpp

将代码升级到更高版本的 cpp

最近开始从事 c++ 程序员的工作。我正在做一个项目,为我的项目创建 docker 镜像。在编译过程中,我不断收到以下错误,尝试了多种方法。当前版本是 gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0,我要升级到的版本是 gcc (Debian 10.2.1-6) 10.2.1 20210110

错误:

generic_x86_64/prod/build/s/p/Cab.cc: In function 'boost::process::posix_status p::Cab::Run(const string&, const std::vector<std::__cxx11::basic_string<char> >&, p::Cab::OutputProcessor*, const string*)':
generic_x86_64/prod/build/system/process/Child.cc:153:46: error: 'class boost::process::child' has no member named 'get_stdin'
 153 |         boost::process::postream& in = child.get_stdin();
     |                                              ^~~~~~~~~
generic_x86_64/prod/build/system/p/Cab.cc:162:43: error: 'class boost::process::child' has no member named 'get_stdout'
 162 |     boost::process::pistream& out = child.get_stdout();
     |                                           ^~~~~~~~~~
generic_x86_64/prod/build/s/p/Cab.cc:170:53: error: conversion from 'void' to non-scalar type 'boost::process::posix_status' requested
 170 |     boost::process::posix_status status = child.wait();
     |                                           ~~~~~~~~~~^~
generic_x86_64/prod/build/s/p/Cab.cc: In function 'boost::process::posix_status process::Child::Run(const string&, const std::vector<std::__cxx11::basic_string<char> >&, process::Child::OutputProcessor*, std::stringstream&)':
generic_x86_64/prod/build/s/p/Cab.cc:225:42: error: 'class boost::process::child' has no member named 'get_stdin'
 225 |     boost::process::postream& in = child.get_stdin();
     |                                          ^~~~~~~~~
generic_x86_64/prod/build/system/process/Child.cc:232:43: error: 'class boost::process::child' has no member named 'get_stdout'
 232 |     boost::process::pistream& out = child.get_stdout();
     |                                           ^~~~~~~~~~
generic_x86_64/prod/build/s/p/Cab.cc:239:53: error: conversion from 'void' to non-scalar type 'boost::process::posix_status' requested

但是,当我检查 boost/process/child.hpp 类时,上面提到的所有函数确实存在。粘贴下面的示例供您参考:

namespace boost { ^M
namespace process { ^M
^M
/** ^M
 * Generic implementation of the Child concept. ^M
 * ^M
 * The child class implements the Child concept in an operating system ^M
 * agnostic way. ^M
 */ ^M
class child : public process ^M
{ ^M
public: ^M
    /** ^M
     * Gets a reference to the child's standard input stream. ^M
     * ^M
     * Returns a reference to a postream object that represents the ^M
     * standard input communication channel with the child process. ^M
     */ ^M
    postream &get_stdin() const ^M
    { ^M
        BOOST_ASSERT(stdin_); ^M
^M
        return *stdin_; ^M
    } ^M
^M
    /** ^M
     * Gets a reference to the child's standard output stream. ^M
     * ^M
     * Returns a reference to a pistream object that represents the ^M
     * standard output communication channel with the child process. ^M
     */ ^M
    pistream &get_stdout() const ^M
    { ^M
        BOOST_ASSERT(stdout_); ^M
^M
        return *stdout_; ^M
    } ^M

请帮助我解决这个问题,因为我被困在这里了。

相关内容