Boost logo

Boost Users :

From: Scott (cheesy4poofs_at_[hidden])
Date: 2006-09-14 13:49:38


I'm trying to link a win32 console app using program options. I have
previously build boost with bjam using MSVS 7.1. My program, which is
pretty basic and taken from first.cpp looks something like this:

int _tmain(int argc, _TCHAR* argv[])
{
    try
        {
        po::options_description desc("Allowed options");
        desc.add_options()
            ("help", "produce help message")
                        ("set,s", po::value< std::vector<std::string> >(),
"Set one or more node values, overriding stored value in config file")
        ;

        po::variables_map vm;
        po::store(po::parse_command_line(argc, argv, desc), vm);
        po::notify(vm);

        if (vm.count("help"))
                {
                        std::cout << desc << "\n";
        }
        [snip]

The program is compiled as _UNICODE. It seems to compile ok, though I get
the following warnings:

..\API\inc\boost\program_options\errors.hpp(21) : warning C4275: non
dll-interface class 'std::logic_error' used as base for dll-interface class
'boost::program_options::error'
        C:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\stdexcept(14) : see declaration of 'std::logic_error'
        ..\API\inc\boost\program_options\errors.hpp(21) : see declaration of
'boost::program_options::error'
..\API\inc\boost\program_options\variables_map.hpp(130) : warning C4273:
'boost::program_options::store' : inconsistent dll linkage
..\API\inc\boost\program_options\variables_map.hpp(138) : warning C4273:
'boost::program_options::store' : inconsistent dll linkage

But then I get linker errors, like this:

NwEngine.obj : error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall
boost::program_options::basic_parsed_options<unsigned
short>::~basic_parsed_options<unsigned short>(void)"
(__imp_??1?$basic_parsed_options_at_G@program_options_at_boost@@QAE_at_XZ) referenced
in function _wmain

I have the following lib files in my lib path:

boost_program_options-vc71-mt-1_33_1.lib
boost_program_options-vc71-mt-gd-1_33_1.lib
libboost_program_options-vc71-mt-1_33_1.lib
libboost_program_options-vc71-mt-gd-1_33_1.lib
libboost_program_options-vc71-mt-s-1_33_1.lib
libboost_program_options-vc71-mt-sgd-1_33_1.lib

Am I supposed to do something special to link to them? I was under the
impression that it worked similar to boost regex and auto-linked.

Thanks,
Scott


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net