I’m having trouble building a simple c++ program that tests out regex’s from the boost library. The problem that I’m having is occurring in the linking stage and I don’t know enough to fix the error on my own.
In the .cpp program that uses regexes I used the following include line.
#include <boost/regex.hpp>
I don’t know enough to figure out what command I should use to build the program using g++. I tried using the following command line (and variations of it) to build the program.
g++ -I/usr/include/regex -L/usr/lib -llibboost_regex main.cpp -o regex_test
Other information that might be relevant:
Operating system: Arch linux
g++ version: 4.6.2 20120120 (prerelease)
Any help would be appreciated.
Assume you have installed Boost with the
boostandboost-libspackages,<boost/regex.hpp>should exist in/usr/include/boost/regex.hpp. You don’t need to use any-Iflags since/usr/includeshould be included by default.-Lflag either since/usr/libshould also be included by default when linking.-lflag to link with a librarylibfoo.so, the leading “lib” part should be removed.The command line should therefore be: