[Regex] Boost.Regex - can't compile/link...
Hey there,
I am trying to compile a very simple example program that I copied from the
boost getting started guide for windows (after successfully running a bjam
complete build). BTW: I am using the gcc compiler within the Code::Blocks
IDE on Windows XP.
Here is the code, just in case:
==========================================================
#include
On Feb 2, 2011, at 10:45 AM, Robert Pennington wrote:
Hey there,
I am trying to compile a very simple example program that I copied from the boost getting started guide for windows (after successfully running a bjam complete build). BTW: I am using the gcc compiler within the Code::Blocks IDE on Windows XP.
Here is the code, just in case:
==========================================================
#include
#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; } }
==========================================================
Every time I try to compile this code (by hitting the 'Build and Run' button in Code::Blocks), I get a whole bunch of error messages. The first one I get is: "C:\Program Files\boost\boost_1_45_0\boost \regex\v4\cpp_regex_traits.hpp|366|undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'|". Any ideas? Hello Rob
I'm not familiar with Windows or the IDE you're using, but the error indicates to me that the tool is not finding the boost/regex headers. Do you see an error message 'File not found' associated with the header include? Do you have your boost home directory in your include path however your IDE does it? Cheers Mike
Thanks in advance,
Rob Pennington _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
AMDG On 2/2/2011 8:45 AM, Robert Pennington wrote:
Every time I try to compile this code (by hitting the 'Build and Run' button in Code::Blocks), I get a whole bunch of error messages. The first one I get is: "C:\Program Files\boost\boost_1_45_0\boost\regex\v4\cpp_regex_traits.hpp|366|undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'|". Any ideas?
You need to link to the boost_regex library. In Christ, Steven Watanabe
Durrr. I added all my paths and included the library directory in my search
directories (in Code::Blocks), but yes I forgot to link the actual library!
Thanks for the quick replies!
Rob Pennington
On Wed, Feb 2, 2011 at 2:01 PM, Steven Watanabe
AMDG
On 2/2/2011 8:45 AM, Robert Pennington wrote:
Every time I try to compile this code (by hitting the 'Build and Run' button in Code::Blocks), I get a whole bunch of error messages. The first one I get is: "C:\Program Files\boost\boost_1_45_0\boost\regex\v4\cpp_regex_traits.hpp|366|undefined reference to `boost::re_detail::cpp_regex_traits_char_layer<char>::init()'|". Any ideas?
You need to link to the boost_regex library.
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (3)
-
Michael Muratet
-
Robert Pennington
-
Steven Watanabe