Boost logo

Boost Users :

From: Scott Meyers (Usenet_at_[hidden])
Date: 2003-12-09 22:48:46


On Tue, 09 Dec 2003 18:59:40 -0500, Beman Dawes wrote:
> Here is a gcc command that works for me (after the libraries have been
> built):

Thanks for the help. The following works for me:

  set BOOST_FILESYSTEM_LIB=D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib
\gcc\debug\runtime-link-dynamic\libboost_filesystem.lib
  g++ -Id:\C++\Boost\Current -o simple_ls.exe simple_ls.cpp %BOOST_FILESYSTEM_LIB%

Unfortunately, I haven't been able to find a way to make it work for VC7.1.
This is my most recent effort:

  set BOOST_FILESYSTEM_LIB=D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib
\vc7\debug\runtime-link-dynamic\libboost_filesystem.lib
  cl /TP /W4 /WL /GX /GR -ID:\C++\Boost\Current simple_ls.cpp /link /defaultlib:%
BOOST_FILESYSTEM_LIB%

This elicits multiply-defined symbols errors:

  simple_ls.cpp
  Microsoft (R) Incremental Linker Version 7.10.3077
  Copyright (C) Microsoft Corporation. All rights reserved.
  
  /out:simple_ls.exe
  /defaultlib:D:\C++\Boost\Current\libs\filesystem\build\bin\libboost_filesystem.lib\vc7\debug
\runtime-link-dynamic\libboost_filesystem.lib
  simple_ls.obj
  msvcprtd.lib(MSVCP71D.dll) : error LNK2005: "public: char const & __thiscall std::basic_string
<char,struct std::char_traits<char>,class std::allo
  cator<char> >::operator[](unsigned int)const " (??A?$basic_string_at_DU?$char_traits_at_D@std@@V?
$allocator_at_D@2@@std@@QBEABDI_at_Z) already defined in sim
  ple_ls.obj
  ...
  [Many more LNK2005 errors removed]
  ...
  LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use
/NODEFAULTLIB:library
  simple_ls.exe : fatal error LNK1169: one or more multiply defined symbols found

I expect that I can figure out the LNK4098 warning myself, but I'm not sure
what to do about the LNK2005s. For that matter, I'm not sure if I've
formed the command line correctly for what I want to do. My attempts to
decipher the documentation for the command line compiler and linker and
interactions thereof have been in vain. Does anybody happen to know what
the right invocation is? If not, that's fine, I can post elsewhere, as
this is really an MSVC question, not a Boost question.

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