I am attempting to compile a simple c++ program that uses boost regex, just to check that all of the libraries / headers have been correctly installed.
/usr/local/include/boost
Contains all of the headers. In particular, for my program:
regex (which is a binary - does anyone know what this is for by the way?)
regex.h - the header declarations for #include directive
regex.hpp - the source for the functions declared in the header
Next, I have:
/usr/local/lib - That contains all of the relevant libraries. Again, for my test program, I am interested in regex libraries:
libboost_regex.a - The static library
libboost_regex.so - The shared / dynamic library
libboost_regex.so.4 - (In passing, I would like to know what this is for)
Now this is the simple toy program that I am trying to compile:
I then enter this command to compile the above:
And this is the output I get:
The strange thing is that the supposed missing file is in place. Can anyone help with this please?
/usr/local/include/boost
Contains all of the headers. In particular, for my program:
regex (which is a binary - does anyone know what this is for by the way?)
regex.h - the header declarations for #include directive
regex.hpp - the source for the functions declared in the header
Next, I have:
/usr/local/lib - That contains all of the relevant libraries. Again, for my test program, I am interested in regex libraries:
libboost_regex.a - The static library
libboost_regex.so - The shared / dynamic library
libboost_regex.so.4 - (In passing, I would like to know what this is for)
Now this is the simple toy program that I am trying to compile:
Code:
#include <iostream>
#include <string>
#include <regex.h>
int main()
{
std::string pattern("FreeBSD");
pattern = "[[:alpha:]]*" + pattern + "[[:alpha:]]*";
boost::regex r(pattern);
boost::smatch results;
std::string test_str = "This is a FreeBSD test not a test for freebsd";
if(boost::regex_search(test_str, results, r))
std::cout << results.str() << std::endl;
return 0;
}
I then enter this command to compile the above:
# clang test.cpp -o test -I/usr/local/include/boost -L/usr/local/lib/libboost_regex.so
And this is the output I get:
Code:
"In file included from test.cpp:3:
/usr/local/include/boost/regex.h:22:10: fatal error: 'boost/cregex.hpp' file not found
#include <boost/cregex.hpp>
1 error generated."