Thread: Error: undefined reference to 'boost::gregorian::greg_month::get_month_map_ptr() '

  1. #1
    Registered User
    Join Date
    Apr 2008

    Error: undefined reference to 'boost::gregorian::greg_month::get_month_map_ptr() '

    Hi i get this error on Eclipse CDT with MinGW compiler ... Here's my Little program

    #include "boost/date_time/gregorian/gregorian.hpp"
    #include <iostream>
    int main()
    	using namespace boost::gregorian;
    	std::string s;
    	std::cout << "Enter birth day YYYY-MM-DD (eg: 2002-02-01): ";
    	std::cin >> s;
    	try {
    		date birthday(from_simple_string(s));
    		date today = day_clock::local_day();
    		days days_alive = today - birthday;
    		days one_day(1);
    		if (days_alive == one_day) {
    			std::cout << "Born yesterday, very funny" << std::endl;
    		else if (days_alive < days(0)) {
    			std::cout << "Not born yet, hmm: " << days_alive.days()
                    		<< " days" <<std::endl;
    		else {
    			std::cout << "Days alive: " << days_alive.days() << std::endl;
    	catch(...) {
    		std::cout << "Bad date entered: " << s << std::endl;
    	return 0;
    Please help

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    You would need to compile that part of Boost and link to it.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Apr 2008
    Quote Originally Posted by laserlight View Post
    You would need to compile that part of Boost and link to it.
    I though so but not sure how to .. I know it probably looking for a '.a' file which needs to be added to MinGW Linker in eclipse ... Do i do this in command prompt, and how?

  4. #4
    Registered User
    Join Date
    Apr 2008
    I'm thinking if i rather user the boost Windows Installer, it should do all the compilation for me. Currently i'm using the boost folder which came with MinGW perhaps thats the cause of the probelm. BTW whats the difference between an include folder and the lib folder installed by boost, infact it appears boost installer only installs the lib folder which contains no .hpp/.cpp files ?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM