Christian Henning wrote:
Hi there, my project is using its own created zlib.lib, thats why I want to create the iostreams libs using our own zlib.lib . Creating the iostreams libs I use the following build command:
bjam -sTOOLS=vc-7_1 --libdir=c:\boost\lib --with-iostreams "-sZLIB_BINARY=C:\CHH\External\Libraries\Release\zlib" "-sZLIB_INCLUDE=C:\CHH\External\Includes\zlib" "-sZLIB_LIBPATH=C:\CHH\External\Libraries\Release" --without-python stage
Note that the ZLIB_SOURCE variable is missing. Otherwise the build would create it's own zlib library.
Here is the warning I get when bjam is building the debug lib:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
The problem arises because it's using a release built zlib.lib with the debug built iostream lib, since I can only pass one zlib to the build command.
If you want to avoid all warnings, you may have to set ZLIB_LIBPATH, etc. to point to a debug variant of your project's zlib when building a debug variant of Boost.Iostreams, and to a release variant when building a release variant of Boost.Iostreams. I'm inclined to think that this may be one case where you can probably ignore the warnings and mix runtime libraries (because zlib makes very limited use of the C standard library and no use of the C++ standard library, and manages its own resources). What happens when you run your code?
A solution would be to have two variables ZLIB_LIBPATH_DEBUG and ZLIB_LIBPATH_RELEASE. Which is the standard procedure.
This might help in your situation, but it wouldn't prevent the same warnings in the common case where someone want to use Boost.Iostreams with the standard zlib DLL available at zlib.org. That DLL was built to use a particular microsoft runtime library, and whenever you use build Boost.Iostreams with a different runtime library, you can get errors like the above.
Or is there a variable in the boost build for creating debug lib only?
I'm not sure I understand.
Greets, Christian
-- Jonathan Turkanis www.kangaroologic.com