User forums > Using Code::Blocks
How to link with platform dependent libraries (Different name)?
(1/1)
lirong:
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
kelo81:
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.
Deschamps:
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>
--- End code ---
Navigation
[0] Message Index
Go to full version