Thank you! I was unaware of this huge library!
I am using mingw, so install is a bit more complex, but I found a github method which works
(search zrsmithson if anyone else needs it)
So now I have (many) header files:
C:\boost\include\boost-1_62\boost
And (many) Lib files:
C:\boost\lib
And an example.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
//#include <boost/regex.hpp> //via boost example
#include "C:\boost\include\boost-1_62\boost\regex.hpp" //my machine
#include <iostream>
#include <string>
int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );
while (std::cin)
{
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout << matches[2] << std::endl;
}
}
|
So a standard C++ library format I guess.
Problem is I can't get this to compile! I know I need to supply the header files to compiler and the lib files to the linker, but am very confused as to how. I have this problem with other libraries too so it is my lack of knowledge...
eg I think it is something like this...
First of all convert example.cpp to object:
g++ -c example.cpp -o example.o
//other stuff here, not sure
Now link it:
g++ example.o -I. -L. -l -o example.exe
I am just not sure what flags to use. eg
-LC:\boost\lib
-IC:\boost\include\boost-1_62\boost
But I am not sure and pretty confused, especially coming from Python!
Any tips gratefully received