Boost logo

Boost Users :

From: Robert Brueckmann (killerbob_at_[hidden])
Date: 2007-10-15 06:41:54


I tried to compile a simple test program, but it doesn't link
dynamically. Any suggestions, what I'm doing wrong?

I'm using boost 1.34.1 prebuilt libs from boost-consulting and MSVC 7.1.

The test code which fails:

#include <boost/program_options.hpp>

namespace po = boost::program_options;

int main(int argc, char** argv)
{
  unsigned int i1;

  po::options_description normal_options("parameters");
  normal_options.add_options()
    ("test,t", po::value<unsigned int>(&i1)->default_value(0), "test")
  ;

  return 0;
}

I compile using the following command:

cl /TP /EHsc /nologo /GR /WL /W2 /Od /MDd /GS /Z7 /DBOOST_ALL_NO_LIB
/Ih:\repos\trunk\3rd\include\common\boost\1_34_1 /c main.cpp /Fomain.obj

The linker command

link /nologo /OUT:test.exe
/LIBPATH:h:\repos\trunk\3rd\lib\win32\cl\13.10\boost\1_34_1
boost_program_options-vc71-mt-gd-1_34_1.lib /DEBUG main.obj

fails with the error message

main.obj : error LNK2001: unresolved external symbol "class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> > boost::program_options::arg"
(?arg_at_program_options_at_boost@@3V?$basic_string_at_DU?$char_traits_at_D@std@@V?$allocator_at_D@2@@std@@A)

However, when linking statically using

link /nologo /OUT:test.exe
/LIBPATH:h:\repos\trunk\3rd\lib\win32\cl\13.10\boost\1_34_1
libboost_program_options-vc71-mt-gd-1_34_1.lib /DEBUG main.obj

then everything is working...

Any ideas?

Thank you in advance,
Robert


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