I'm trying to build the following code:
Content of "stdafx.h"
#define BOOST_ALL_DYN_LINK
#include <boost/lambda/lambda.hpp>
...
#undef BOOST_ALL_DYN_LINK
#include <boost/program_options.hpp>
Content of "Source.cpp"
#include "stdafx.h"
namespace po = boost::program_options;
int main(int argc, char* argv[])
{
po::options_description desc("Program Options");
desc.add_options()
("help", "print info");
po::variables_map vm;
auto parsed = po::parse_command_line(argc, argv, desc);
po::store(parsed, vm);
po::notify(vm);
...
}
I'm trying to compile it with the following command:
g++ -I D:/boost_1_72_0 -LD:/boost_1_72_0/stage/lib -lboost_program_options-vc142-mt-gd-x32-1_72 Source.cpp -o test
But get errors:
C:\Users\User\AppData\Local\Temp\cc0g4Ogn.o:Source.cpp:(.text+0x1f): undefined reference to `boost::program_options::options_description::m_default_line_length'
... etc for each used element.
There's no problem when I compile it with Visual Studio though.