Author Topic: How to link with platform dependent libraries (Different name)?  (Read 6770 times)

lirong

  • Guest
Hi,
I need to link my application with boost c++ libraries.  On Linux, I need to add "boost_date_time.a", but on Windows, it is some thing like this "boost_date_time-mgw-mt-d-1_33_1.lib".  How can I solve this problem?

TIA

Offline kelo81

  • Multiple posting newcomer
  • *
  • Posts: 86
Re: How to link with platform dependent libraries (Different name)?
« Reply #1 on: May 28, 2007, 01:19:56 pm »
Hi, you may create two different targets for the same project, something like "Win32" and "linux", and then you may add the libs to each target.
Ezequiel Ruiz
Tango/04 consultant
www.tango04.com

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: How to link with platform dependent libraries (Different name)?
« Reply #2 on: May 28, 2007, 02:08:05 pm »
You can also build your boost libraries (see documentation) with the --layout=system parameter for a generic naming without versions nor compilers "build info", so you'll have the same names in Linux or Windows platforms. For instance:

Code
C:\Devtools\boost_1_34_0\libs\date_time\build>bjam --toolset=gcc release --without-python --layout=system
Building Boost.Regex with the optional Unicode/ICU support disabled.
Please refer to the Boost.Regex documentation for more information
(don't panic: this is a strictly optional feature).
...patience...
...found 436 targets...
...updating 4 targets...
gcc.compile.c++ ..\..\..\bin.v2\libs\date_time\build\gcc-mingw-3.4.5\release\greg_month.o
gcc.compile.c++ ..\..\..\bin.v2\libs\date_time\build\gcc-mingw-3.4.5\release\greg_weekday.o
gcc.compile.c++ ..\..\..\bin.v2\libs\date_time\build\gcc-mingw-3.4.5\release\date_generators.o
gcc.link.dll ..\..\..\bin.v2\libs\date_time\build\gcc-mingw-3.4.5\release\boost_date_time.a ..\..\..\bin.v2 \libs\date_time\build\gcc-mingw-3.4.5\release\boost_date_time.dll
Creating library file: ..\..\..\bin.v2\libs\date_time\build\gcc-mingw-3.4.5\release\boost_date_time.a
...updated 4 targets...

C:\Devtools\boost_1_34_0\libs\date_time\build>

« Last Edit: May 28, 2007, 02:18:46 pm by Deschamps »
Those who were seen dancing were thought to be insane by those who could not hear the music