A default build of this library does not enable Unciode support via ICU. There
is no need to enable this support if you don't need it, but if you use ICU
for your Unicode support already, and want to work with Unicode-aware regular
expressions then read on.
</p>
<p>
Most of the information you will need is in the getting started guide, the
only additional step you need to take is to tell bjam that you want Boost.Regex
to use ICU and optionally to tell bjam where ICU is located.
</p>
<p>
If you're building on a Unix-like platform, and ICU is already installed in
your compilers search path (with an install prefix of <codeclass="computeroutput"><spanclass="special">/</span><spanclass="identifier">usr</span></code> or <codeclass="computeroutput"><spanclass="special">/</span><spanclass="identifier">usr</span><spanclass="special">/</span><spanclass="identifier">local</span></code>
for example), then set the environment variable <codeclass="computeroutput"><spanclass="identifier">HAVE_ICU</span></code>
to enable ICU support. For example you might build with the command line:
If ICU is not already in your compiler's path then you need to set the environment
variable <codeclass="computeroutput"><spanclass="identifier">ICU_PATH</span></code> to point
to the root directory of your ICU installation, for example if ICU was installed
to <codeclass="computeroutput"><spanclass="special">/</span><spanclass="identifier">usr</span><spanclass="special">/</span><spanclass="identifier">local</span><spanclass="special">/</span><spanclass="identifier">icu</span><spanclass="special">/</span><spanclass="number">3.3</span></code>
<ahref="install.html#boost_regex.install.borland_c___builder_">Borland C++ Builder:</a>
</h6>
<divclass="itemizedlist"><ultype="disc">
<li>
Open up a console window and change to the <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">>\</span><spanclass="identifier">libs</span><spanclass="special">\</span><spanclass="identifier">regex</span><spanclass="special">\</span><spanclass="identifier">build</span></code>
directory.
</li>
<li>
Select the appropriate makefile (bcb4.mak for C++ Builder 4, bcb5.mak for
C++ Builder 5, and bcb6.mak for C++ Builder 6).
</li>
<li>
Invoke the makefile (pass the full path to your version of make if you have
more than one version installed, the makefile relies on the path to make
to obtain your C++ Builder installation directory and tools) for example:
</li>
</ul></div>
<preclass="programlisting">make -fbcb5.mak</pre>
<p>
The build process will build a variety of .lib and .dll files (the exact number
depends upon the version of Borland's tools you are using) the .lib and dll
files will be in a sub-directory called bcb4 or bcb5 depending upon the makefile
used. To install the libraries into your development system use:
library files will be copied to <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">BCROOT</span><spanclass="special">>/</span><spanclass="identifier">lib</span></code> and the dll's to <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">BCROOT</span><spanclass="special">>/</span><spanclass="identifier">bin</span></code>, where <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">BCROOT</span><spanclass="special">></span></code>
corresponds to the install path of your Borland C++ tools.
</p>
<p>
You may also remove temporary files created during the build process (excluding
Finally when you use Boost.Regex it is only necessary for you to add the <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">></span></code> root director to your list of include directories
for that project. It is not necessary for you to manually add a .lib file to
the project; the headers will automatically select the correct .lib file for
your build mode and tell the linker to include it. There is one caveat however:
the library can not tell the difference between VCL and non-VCL enabled builds
when building a GUI application from the command line, if you build from the
command line with the 5.5 command line tools then you must define the pre-processor
symbol _NO_VCL in order to ensure that the correct link libraries are selected:
the C++ Builder IDE normally sets this automatically. Hint, users of the 5.5
command line tools may want to add a -D_NO_VCL to bcc32.cfg in order to set
this option permanently.
</p>
<p>
If you would prefer to do a dynamic link to the regex libraries when using
the dll runtime then define BOOST_REGEX_DYN_LINK (you must do this if you want
to use Boost.Regex in multiple dll's), otherwise Boost.Regex will be statically
linked by default.
</p>
<p>
If you want to suppress automatic linking altogether (and supply your own custom
build of the lib) then define BOOST_REGEX_NO_LIB.
</p>
<p>
If you are building with C++ Builder 6, you will find that <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">/</span><spanclass="identifier">regex</span><spanclass="special">.</span><spanclass="identifier">hpp</span><spanclass="special">></span></code>
can not be used in a pre-compiled header (the actual problem is in <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">locale</span><spanclass="special">></span></code> which gets included by <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">/</span><spanclass="identifier">regex</span><spanclass="special">.</span><spanclass="identifier">hpp</span><spanclass="special">></span></code>),
if this causes problems for you, then try defining BOOST_NO_STD_LOCALE when
building, this will disable some features throughout boost, but may save you
You need version 6 or later of MSVC to build this library. If you are using
VC5 then you may want to look at one of the previous releases of this library.
</p>
<p>
Open up a command prompt, which has the necessary MSVC environment variables
defined (for example by using the batch file Vcvars32.bat installed by the
Visual Studio installation), and change to the <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">>\</span><spanclass="identifier">libs</span><spanclass="special">\</span><spanclass="identifier">regex</span><spanclass="special">\</span><spanclass="identifier">build</span><spanclass="identifier">directory</span></code>.
</p>
<p>
Select the correct makefile - vc6.mak for "vanilla" Visual C++ 6
or vc6-stlport.mak if you are using STLPort.
</p>
<p>
Invoke the makefile like this:
</p>
<preclass="programlisting">nmake -fvc6.mak</pre>
<p>
You will now have a collection of lib and dll files in a "vc6" subdirectory,
to install these into your development system use:
The lib files will be copied to your <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">VC6</span><spanclass="special">>\</span><spanclass="identifier">lib</span></code> directory and the dll files to <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">VC6</span><spanclass="special">>\</span><spanclass="identifier">bin</span></code>, where <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">VC6</span><spanclass="special">></span></code> is
the root of your Visual C++ 6 installation.
</p>
<p>
You can delete all the temporary files created during the build (excluding
Finally when you use Boost.Regex it is only necessary for you to add the <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">></span></code> root directory to your list of include
directories for that project. It is not necessary for you to manually add a
.lib file to the project; the headers will automatically select the correct
.lib file for your build mode and tell the linker to include it.
</p>
<p>
Note that if you want to dynamically link to the regex library when using the
dynamic C++ runtime, define BOOST_REGEX_DYN_LINK when building your project.
</p>
<p>
If you want to add the source directly to your project then define BOOST_REGEX_NO_LIB
to disable automatic library selection.
</p>
<p>
There are several important caveats to remember when using Boost.Regex with
Microsoft's Compiler:
</p>
<divclass="itemizedlist"><ultype="disc">
<li>
There have been some reports of compiler-optimization bugs affecting this
library, (particularly with VC6 versions prior to service patch 5) the workaround
is to build the library using /Oityb1 rather than /O2. That is to use all
optimization settings except /Oa. This problem is reported to affect some
standard library code as well ( in fact I'm not sure if the problem is with
the regex code or the underlying standard library), so it's probably worthwhile
applying this workaround in normal practice in any case.
</li>
<li>
If you have replaced the C++ standard library that comes with VC6, then when
you build the library you must ensure that the environment variables "INCLUDE"
and "LIB" have been updated to reflect the include and library
paths for the new library - see vcvars32.bat (part of your Visual Studio
installation) for more details.
</li>
<li>
If you are building with the full STLPort v4.x, then use the vc6-stlport.mak
file provided and set the environment variable STLPORT_PATH to point to the
location of your STLPort installation (Note that the full STLPort libraries
appear not to support single-thread static builds).
</li>
<li>
If you are building your application with /Zc:wchar_t then you will need
to modify the makefile to add /Zc:wchar_t before building the library.
<ahref="install.html#boost_regex.install.gcc_2_95_and_later_">GCC(2.95 and later)</a>
</h6>
<p>
You can build with gcc using the normal boost Jamfile in <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">>/</span><spanclass="identifier">libs</span><spanclass="special">/</span><spanclass="identifier">regex</span><spanclass="special">/</span><spanclass="identifier">build</span></code>, alternatively
there is a conservative makefile for the g++ compiler. From the command prompt
change to the <boost>/libs/regex/build directory and type:
</p>
<preclass="programlisting">make -fgcc.mak </pre>
<p>
At the end of the build process you should have a gcc sub-directory containing
release and debug versions of the library (libboost_regex.a and libboost_regex_debug.a).
When you build projects that use regex++, you will need to add the boost install
directory to your list of include paths and add <boost>/libs/regex/build/gcc/libboost_regex.a
to your list of library files.
</p>
<p>
There is also a makefile to build the library as a shared library:
which will build libboost_regex.so and libboost_regex_debug.so.
</p>
<p>
Both of the these makefiles support the following environment variables:
</p>
<p>
ICU_PATH: tells the makefile to build with Unicode support, set to the path
where your ICU installation is located, for example with: make ICU_PATH=/usr/local
install -fgcc.mak
</p>
<p>
CXXFLAGS: extra compiler options - note that this applies to both the debug
and release builds.
</p>
<p>
INCLUDES: additional include directories.
</p>
<p>
LDFLAGS: additional linker options.
</p>
<p>
LIBS: additional library files.
</p>
<p>
For the more adventurous there is a configure script in <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">>/</span><spanclass="identifier">libs</span><spanclass="special">/</span><spanclass="identifier">config</span></code>;
see the <ahref="../../../../config/index.html"target="_top">config library documentation</a>.
There is a makefile for the sun (6.1) compiler (C++ version 3.12). From the
command prompt change to the <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">>/</span><spanclass="identifier">libs</span><spanclass="special">/</span><spanclass="identifier">regex</span><spanclass="special">/</span><spanclass="identifier">build</span></code> directory
At the end of the build process you should have a sunpro sub-directory containing
single and multithread versions of the library (libboost_regex.a, libboost_regex.so,
libboost_regex_mt.a and libboost_regex_mt.so). When you build projects that
use Boost.Regex, you will need to add the boost install directory to your list
of include paths and add <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">>/</span><spanclass="identifier">libs</span><spanclass="special">/</span><spanclass="identifier">regex</span><spanclass="special">/</span><spanclass="identifier">build</span><spanclass="special">/</span><spanclass="identifier">sunpro</span><spanclass="special">/</span></code> to
your library search path.
</p>
<p>
Both of the these makefiles support the following environment variables:
</p>
<p>
CXXFLAGS: extra compiler options - note that this applies to both the single
and multithreaded builds.
</p>
<p>
INCLUDES: additional include directories.
</p>
<p>
LDFLAGS: additional linker options.
</p>
<p>
LIBS: additional library files.
</p>
<p>
LIBSUFFIX: a suffix to mangle the library name with (defaults to nothing).
</p>
<p>
This makefile does not set any architecture specific options like -xarch=v9,
you can set these by defining the appropriate macros, for example:
There is a generic makefile (generic.mak ) provided in <codeclass="computeroutput"><spanclass="special"><</span><spanclass="identifier">boost</span><spanclass="special">-</span><spanclass="identifier">root</span><spanclass="special">>/</span><spanclass="identifier">libs</span><spanclass="special">/</span><spanclass="identifier">regex</span><spanclass="special">/</span><spanclass="identifier">build</span></code> - see that makefile for details of
environment variables that need to be set before use.