1

I changed the process::child to process::v1::child. I got an error so i did some research. I found that i should put the Args into an vector of wstring. But that didn't change anything. I did a complete Rebuild. Recompiled boost and tried every property settings i found. But nothing change. I also tried the compilation with vs 2019 and vs 2022

#include <boost/process/v1.hpp>
#include <filesystem>
#include <iostream>

int main() {
    std::filesystem::path unzipperPath = "C:\\Program Files\\7-Zip\\7z.exe";
    std::filesystem::path outputDir = "", zipFilePath = "test.zip";
    try {
        boost::process::v1::environment env = boost::this_process::environment();
        boost::process::v1::ipstream    output;

        std::wstring outputArg = L"-o" + outputDir.wstring();

        std::vector<std::wstring> sevenZipArgs = {L"x", zipFilePath.wstring(), outputArg};

        boost::process::v1::child unzipProcess( //
            unzipperPath.wstring(),             //
            sevenZipArgs,                       //
            env,                                //
            boost::process::v1::std_out > output);

    } catch (boost::process::v1::process_error const& e) {
        std::cerr << "Process error: " << e.what() << std::endl;
    } catch (boost::system::system_error const& e) {
        std::cerr << "System error: " << e.what() << std::endl;
    } catch (std::exception const& e) {
        std::cerr << "General exception: " << e.what() << std::endl;
    }
}

Error messages:

C2027   use of undefined type 'boost::process::v1::detail::initializer_builder<boost::process::v1::detail::env_tag<char>>'
C2955   'boost::type': use of class template requires template argument list
C3203   'type': un-specialized class template can't be used as a template argument for template parameter 'Key', expected a real type
C3203   'type': un-specialized class template can't be used as a template argument for template parameter 'Args', expected a real type
C2510   'T': must be a class or namespace when followed by '::'
C2510   'T': left of '::' must be a class/struct/union
C3668   'type': unknown override specifier
C2676   'boost::process::v1::detail::get_initializers': no matching overloaded function found
C2893   Failed to specialize function template 'boost::fusion::tuple_get_initializers_result<Args>::type...>'
C3536   'other_inits': cannot be used before it is initialized
C3536   a template-argument cannot be a type that contains 'auto'
C2856   'T': must be a class or namespace when followed by '::'
C2510   'T': left of '::' must be a class/struct/union
C3668   'type': unknown override specifier
C2039   'type' is not a member of 'boost::fusion::traits::category_of<T>'
C3203   'type': un-specialized class template can't be used as a template argument for template parameter 'Derived', expected a real type
C2039   'type' is not a member of 'boost::fusion::result_of::begin<Sequence1>'
C2955   'boost::type': use of class template requires template argument list
C2039   'type' is not a member of 'boost::fusion::result_of::end<Sequence1>'
C2955   'boost::type': use of class template requires template argument list
C2856   'Sequence': must be a class or namespace when followed by '::'
C2510   'Sequence': left of '::' must be a class/struct/union
C2955   'boost::fusion::extension::size': use of class template requires template argument list
C2039   'type': the symbol to the left of a '::' must be a type
C2039   'type' is not a member of 'boost::fusion::extension::size_impl<boost::fusion::non_fusion_tag>::apply<Sequence>'
C2065   'value': undeclared identifier
C2131   'N': invalid template argument for 'boost::mpl::int_<N>', expected compile-time constant expression
C2955   'boost::type': use of class template requires template argument list
C2955   'boost::type': use of class template requires template argument list
C2955   'boost::type': use of class template requires template argument list
C3203   'type': un-specialized class template can't be used as a template argument for template parameter 'I1', expected a real type
C3203   'type': un-specialized class template can't be used as a template argument for template parameter 'I2', expected a real type
C3203   'type': un-specialized class template can't be used as a template argument for template parameter 'First', expected a real type
C3203   'type': un-specialized class template can't be used as a template argument for template parameter 'Last', expected a real type
2
  • 1
    You should upload images to Stack Overflow rather than rely on external hosting providers. Even better would be to post the text, so that it can be indexed and searched by others. Commented Jun 27 at 6:37
  • 1
    process::v1 is the old implementation, it's only there for backwards compatibility, you certainly can't mix v1 with the current version. Please show a minimal reproducible example as text, not images Commented Jun 27 at 6:43

1 Answer 1

0

The code as shown compiles fine for me: Live On Coliru

However, the compiler message suggests that env is passed as an initializer with env_tag<char> tag. That seems inconsistent with the wide strings, so I'd suggest to see whether using wenvironment works with your compiler/library versions.

    boost::process::v1::wenvironment wenv = boost::this_process::wenvironment();
    boost::process::v1::ipstream     output;

    std::wstring outputArg = L"-o" + outputDir.wstring();

    std::vector<std::wstring> sevenZipArgs = {L"x", zipFilePath.wstring(), outputArg};

    boost::process::v1::child unzipProcess( //
        unzipperPath.wstring(),             //
        sevenZipArgs,                       //
        wenv,                                //
        boost::process::v1::std_out > output);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.