Code Monkey home page Code Monkey logo

Comments (3)

LoneBoco avatar LoneBoco commented on August 20, 2024

The full compiler output for the error is:

1>main.cpp
1>E:\Projects\CPP\boost\boost\exception\exception.hpp(297,6): error C3084: 'boost::exception::~exception': a destructor cannot be 'abstract'
1>E:\Projects\CPP\boost\boost\function\function_template.hpp(761): message : see reference to function template instantiation 'void boost::throw_exception<boost::bad_function_call>(const E &)' being compiled
1>        with
1>        [
1>            E=boost::bad_function_call
1>        ]
1>E:\Projects\CPP\boost\boost\function\function_template.hpp(759): message : while compiling class template member function 'void boost::function1<void,const T &>::operator ()(T0) const'
1>        with
1>        [
1>            T=std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>>,
1>            T0=const std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>> &
1>        ]
1>E:\Projects\CPP\boost\boost\program_options\detail\value_semantic.hpp(45): message : see reference to function template instantiation 'void boost::function1<void,const T &>::operator ()(T0) const' being compiled
1>        with
1>        [
1>            T=std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>>,
1>            T0=const std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>> &
1>        ]
1>E:\Projects\CPP\boost\boost\program_options\value_semantic.hpp(373): message : see reference to class template instantiation 'boost::function1<void,const T &>' being compiled
1>        with
1>        [
1>            T=std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>>
1>        ]
1>E:\Projects\CPP\ModuleTest\main.cpp(15): message : see reference to class template instantiation 'boost::program_options::typed_value<std::vector<std::basic_string<char,std::char_traits<char>,std::allocator<char>>,std::allocator<std::basic_string<char,std::char_traits<char>,std::allocator<char>>>>,char>' being compiled

from program_options.

vprus avatar vprus commented on August 20, 2024

Thank you for the report! Unfortunately, I know next to nothing about import functionality and even less about how it might work with a compiled library, so I don't have any solution.

You might want to investigate further, for example by clarifying why you expect this to work, or trying to import exception headers directly and seeing if that works.

from program_options.

LoneBoco avatar LoneBoco commented on August 20, 2024

Importing a header compiles it as a header unit. A header unit is kinda like a precompiled header, in a way. The big thing is that the preprocessor state before the import has no effect on the contents of the header unit. It's not a simple text replacement. The compiler is processing the header file as its own separate entity. This means that you can't #define a symbol that changes how the header is imported. Basically, you can't #define _UNICODE and then import <Windows.h>; because when the compiler goes to compile Windows.h, it doesn't see that #define.

As for why this is happening, I have no idea! The problem seems to stem from boost::throw_exception. Specifically with wrapexcept. boost::bad_function_call derives from std::runtime_error, but for some reason it fails to convert to a boost exception properly and results in this error.

I had expected this to work since boost libraries don't depend on your preprocessor state at all. They are all self-contained and none of the other parts of boost failed to import.

But I just now tried to import stacktrace and it failed to link, so I'm thinking that maybe some of the complicated boost configuration stuff just doesn't work with modules (maybe when compiler support improves that will change). I would bet that any boost libs that aren't header-only will fail in one way or another. So I'll just stick to using #include when dealing with boost.

from program_options.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.