Problems with Boost Regex in Eclipse CDT

This is a discussion on Problems with Boost Regex in Eclipse CDT within the C++ Programming forums, part of the General Programming Boards category; I'm developing a small game using SDL and recently added a basic parser using boost regex to avoid hardcoding lots ...

  1. #1
    Registered User
    Join Date
    Jan 2008
    Posts
    3

    Problems with Boost Regex in Eclipse CDT

    I'm developing a small game using SDL and recently added a basic parser using boost regex to avoid hardcoding lots of statistical data... after I finally ironed out all the errors and none
    of my code threw any errors CDT sudden spat out a pageful of errors involving the boost files themselves. I, or anyone I have talked to have been at a loss to describe what exactly is going
    on never mind how to fix it...

    The errors...
    Code:
    Severity and Description	Path	Resource	Location	Creation Time	Id
    /usr/include/boost/regex/pattern_except.hpp undefined reference to `boost::re_detail::raise_runtime_error(std::runtime_error const&)'			line 68	1199459180470	4287
    /usr/include/boost/regex/v4/basic_regex.hpp undefined reference to `boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::do_assign(char const*, char const*, unsigned int)'			line 255	1199459180459	4278
    /usr/include/boost/regex/v4/cpp_regex_traits.hpp undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform_primary(char const*, char const*) const'			line 880	1199459180467	4282
    /usr/include/boost/regex/v4/cpp_regex_traits.hpp undefined reference to `boost::re_detail::cpp_regex_traits_implementation<char>::transform(char const*, char const*) const'			line 876	1199459180466	4281
    /usr/include/boost/regex/v4/cpp_regex_traits.hpp undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'			line 424	1199459180468	4285
    /usr/include/boost/regex/v4/cpp_regex_traits.hpp undefined reference to `boost::re_detail::get_default_error_string(boost::regex_constants::error_type)'			line 426	1199459180469	4286
    /usr/include/boost/regex/v4/perl_matcher_common.hpp undefined reference to `boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >::maybe_assign(boost::match_results<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > > const&)'			line 468	1199459180468	4284
    /usr/include/boost/regex/v4/perl_matcher_common.hpp undefined reference to `boost::re_detail::verify_options(unsigned int, boost::regex_constants::_match_flags)'			line 279	1199459180473	4291
    /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::re_detail::get_mem_block()'			line 96	1199459180467	4283
    /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::re_detail::get_mem_block()'			line 186	1199459180471	4288
    /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::re_detail::put_mem_block(void*)'			line 104	1199459180472	4290
    /usr/include/boost/regex/v4/perl_matcher_non_recursive.hpp undefined reference to `boost::re_detail::put_mem_block(void*)'			line 965	1199459180471	4289
    /usr/include/boost/regex/v4/perl_matcher.hpp undefined reference to `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::construct_init(boost::basic_regex<char, boost::regex_traits<char, boost::cpp_regex_traits<char> > > const&, boost::regex_constants::_match_flags)'			line 335	1199459180463	4279
    /usr/include/boost/regex/v4/regex_search.hpp undefined reference to `boost::re_detail::perl_matcher<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<boost::sub_match<__gnu_cxx::__normal_iterator<char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >, boost::regex_traits<char, boost::cpp_regex_traits<char> > >::find()'			line 49	1199459180464	4280
    The code using regex (there are three functions like this... they are nearly identical except for some defaults and types)...
    Code:
    std::list<boost::shared_ptr<ProjectileType> > parseProjectiles(std::string file)
    {
    	std::list<boost::shared_ptr<ProjectileType> > projyTypes;
    	
    	std::map<std::string,std::string> tags;
    	std::ifstream input;
    	
    	input.open(file.c_str(),std::ios::in);
    	std::string fileData((std::istreambuf_iterator<char>(input)), std::istreambuf_iterator<char>());
    	
    	boost::regex bracketRule("\{(. | \n)*?}", boost::regex::icase);
    	boost::smatch bracketResults;
    	
    	boost::regex tagRule(" *?(.*)? *?= *?(.*)? *?\n", boost::regex::icase);
    	boost::smatch tagResults;
    	
    	std::string::const_iterator startB, endB, startT, endT;
    	startB = fileData.begin();
    	endB = fileData.end();
    	
    	while (boost::regex_search(startB, endB, bracketResults, bracketRule))
    	{
    		tags["name"] = "loller";
    		tags["velocity"] = "500";
    		tags["areaofeffect"] = "0";
    		tags["damage"] = "1";
    		tags["graphic"] = "data/projectiles/bullet.png";
    		
    		startT = bracketResults.str(1).begin();
    		endT = bracketResults.str(1).end();
    		
    		while (boost::regex_search(startT, endT, tagResults, tagRule))
    		{
    			tags[tagResults[1]] = tagResults[2];
    		}
    		
    		boost::shared_ptr<ProjectileType> newprojy(new ProjectileType(tags));
    		projyTypes.push_back(newprojy);
    		
    	}
    	
    	return projyTypes;
    	
    }
    Sorry about the massive post width but I figured those errors should be formatted properly.

  2. #2
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    You have to link to libboost_regex.
    Kurt

  3. #3
    Registered User
    Join Date
    Jan 2008
    Posts
    3
    Thanks, I figured it was something stupid after I couldn't find a single thing about it... excuse me while I go destroy the person who told me not to link boost libraries.

  4. #4
    Amazingly beautiful user.
    Join Date
    Jul 2005
    Location
    If you knew I'd have to kill you
    Posts
    254
    Excuse me while I run from you
    Programming Your Mom. http://www.dandongs.com/

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    Quote Originally Posted by Hunter0000 View Post
    Thanks, I figured it was something stupid after I couldn't find a single thing about it... excuse me while I go destroy the person who told me not to link boost libraries.
    Can you please tell me how you solved this, getting same linking problems

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Boost Regex rule run-time error
    By Hunter0000 in forum C++ Programming
    Replies: 0
    Last Post: 01-07-2008, 10:51 AM
  2. Replies: 6
    Last Post: 07-20-2007, 09:23 AM
  3. Replies: 1
    Last Post: 04-26-2007, 08:04 PM
  4. Replies: 14
    Last Post: 11-22-2006, 06:18 PM
  5. Auto-backup : Makefiles (Eclipse and CDT specifically)
    By Ashes999 in forum C++ Programming
    Replies: 0
    Last Post: 07-07-2003, 04:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21