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

This is a discussion on Error: undefined reference to 'boost::gregorian::greg_month::get_month_map_ptr() ' within the C++ Programming forums, part of the General Programming Boards category; Hi i get this error on Eclipse CDT with MinGW compiler ... Here's my Little program Code: #include "boost/date_time/gregorian/gregorian.hpp" #include ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    610

    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

    Code:
    #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
    Location
    Singapore
    Posts
    22,275
    You would need to compile that part of Boost and link to it.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Apr 2008
    Posts
    610
    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
    Posts
    610
    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, 09:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 12:45 PM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 03:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 05:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM

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