|
| |||||||||||||||||||||||||||||||||||||||||||||||
| purefan (15) | |||
|
Hello all, Ive been searching for a good while now and have an idea of what is happening back stage yet cant find a way to fix it. Trying to use regular expressions to find tags in a string:
I include boost/regex.hpp like in every example I found: #include <boost/regex.hpp> and as soon as I do: const boost::regex e("[a-z]+");( Thats my last copy paste to make sure it wasnt a faulty expression ) my regular expression looks like this: std::string sRegex("^" +sTag + "[[:space:]]\"(.*)\"$");where sTag is a function param. When I try to compile I get the following error:
I got Boost from the Ubuntu repositories (Synaptic) and didnt get any error or message to notice. Im using Netbeans 6.8 with g++ if I comment that line out (where the regex is declared) program compiles fine. Anyone ran into this or know how to fix? | |||
|
|
|||
| Bazzy (6258) | |
| How are you compiling? Did you tell the linker that you are using the library? | |
|
|
|
| moorecm (1608) | |
|
Have a quick look at this related thread (and the thread related to it, if necessary): http://www.cplusplus.com/forum/general/20194/ | |
|
|
|
| moorecm (1608) | |
| In Netbeans, try right clicking on the project and going to Properties (if I remember correctly). Somewhere in there you'll be able to specify include paths, library paths, libraries, etc.. I think you'll have to link with the boost_regex library. | |
|
|
|
| purefan (15) | |||
|
Thank you for your suggestions, finally figured it out (I think) here's what I've done (maybe someone will find it helpful in the future) - On Project properties went to the Linker section and added /usr/include/boost;/usr/include/boost/regex (find tells me thats where regex.hpp is), tried to compile again and same problem. - Additional to above (not undoing it), went to Project properties -> C++ Compiler -> Add Library, added /usr/include/boost;/usr/include/boost/regex, still nothing. - Additional to above (also not undoing) tried adding -lboost_regex to the linker (project properties) and got a different error:
so I issued a find: find /usr/lib -name libboost\*.soand found one related to regex:
So went to the Linker properties once again and Add Library, looked for the exact file but it couldnt find it, instead there was a: /usr/lib/libboost_regex-mt.a added that and it compiled, Yay! havent tested it running the full code to search for a match but at least it compiles now. Thank you very much both of you, have a great weeked! | |||
|
|
|||