- 1 year ago
Build Boost (using b2) on Windows, but /MTd instead of /MDd?
When building Boost on Windows using the b2
tool, you can specify the desired runtime library option, such as /MTd
instead of /MDd
. The runtime library option determines how the C/C++ runtime is linked to your Boost libraries. Here's how you can do it:
Open a command prompt: Open a command prompt with administrative privileges.
Navigate to Boost directory: Change the directory to the root directory of your Boost installation where the
b2
executable is located.Build Boost libraries: Execute the following command to build the Boost libraries with the desired runtime library option:
shellb2 runtime-link=static variant=debug link=static threading=multi runtime-debugging=on
In the above command, the
runtime-link=static
option specifies static linking of the C/C++ runtime libraries. Thevariant=debug
option builds the debug version of the libraries. Thelink=static
option instructs Boost to build static libraries. Thethreading=multi
option enables multi-threaded support. Theruntime-debugging=on
option enables runtime debugging support.You can modify the command according to your specific requirements, such as building release libraries (
variant=release
) or using a different threading model.Wait for the build process to complete: The
b2
tool will start building the Boost libraries with the specified options. The process may take some time depending on your system configuration and the selected options.Verify the build: After the build process is complete, verify that the Boost libraries were built with the desired runtime library option by checking the generated library files.
By specifying the appropriate options when invoking b2
, you can control how the Boost libraries are built, including the runtime library option. Make sure to select the options that align with your project's requirements and the recommended practices for your development environment.