-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link Error when use variables_map::contains method #117
Comments
This is quite an old issue, but you're getting this error because your Boost libraries aren't targeting C++20. As you correctly noted In the meantime, |
Would dropping BOOST_PROGRAM_OPTIONS_DECL on types help? Currently, BOOST_PROGRAM_OPTIONS_DECL is used on classes like variables_map and variable_value, which would make the types part of the DLL interface, causing linking problems like this. Here are my modified version of the --- a/boost/program_options/variables_map.hpp 2024-04-08 08:17:53.000000000 +0800
+++ b/boost/program_options/variables_map.hpp 2025-01-17 12:42:55.994258200 +0800
@@ -55,7 +55,7 @@
/** Class holding value of option. Contains details about how the
value is set and allows to conveniently obtain the value.
*/
- class BOOST_PROGRAM_OPTIONS_DECL variable_value {
+ class variable_value {
public:
variable_value() : m_defaulted(false) {}
variable_value(const boost::any& xv, bool xdefaulted)
@@ -98,12 +98,12 @@
void store(const basic_parsed_options<char>& options,
variables_map& m, bool);
- friend class BOOST_PROGRAM_OPTIONS_DECL variables_map;
+ friend class variables_map;
};
/** Implements string->string mapping with convenient value casting
facilities. */
- class BOOST_PROGRAM_OPTIONS_DECL abstract_variables_map {
+ class abstract_variables_map {
public:
abstract_variables_map();
abstract_variables_map(const abstract_variables_map* next);
@@ -143,7 +143,7 @@
This class is derived from std::map<std::string, variable_value>,
so you can use all map operators to examine its content.
*/
- class BOOST_PROGRAM_OPTIONS_DECL variables_map : public abstract_variables_map,
+ class variables_map : public abstract_variables_map,
public std::map<std::string, variable_value>
{
public: |
Env:
Windows 10 19044.1826
Library Config:
vcpkg
, all ports are updated to date.IDE:
Visual Studio 2022 17.2.6
Boost Version:
1.79.0
C++ Version:
C++20
When i use
program_options
library in my program, i got a link error as follows.Other boost libraries are work well with my vcpkg and VS env.
The reproduce code:
I noticed that
variables_map
are inherited fromstd::map
, is something wrong with here?The text was updated successfully, but these errors were encountered: