Open YunchengLiu opened 2 years ago
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 variables_map
inherits from std::map
, so while your compiler is happy to use C++20 methods like std::map::contains
, if Boost isn't being built for C++20 then the symbols won't be available at link time. I would look into how vcpkg
builds Boost - it's almost certainly targeting an older standard.
In the meantime, vm.find("--help") != vm.end()
will work just fine and is exactly the same as vm.contains("--help")
, albeit less convenient.
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?