What version of boost are you using?
I have compiled the above example with boost 1.36 and I am not getting any seg errors.
If you have multiple enhancement libraries, make sure you select the correct version at run time.
Boost regex requires compilation in the -lboost_regex-gcc_whatever-is-your- version
In my case:
g++ -c -Wall -I /include/boost-1_36_0 -o main.o main.cpp g++ -Wall -I /include/boost-1_36_0 -L/lib/boost-1_36_0 -lboost_regex-gcc33-mt main.o -ox
for execution:
LD_LIBRARY_PATH=/lib/boost-1_36_0 ./x
You would indicate the location of boost include / libs in your system, pay attention to the version of gcc and m (ulti) t (hreaded) in the library name - it depends on what you compiled, just look in your boost lib and select one version regular expression libraries.
source share