0
#include<iostream>

#include<string>

#include "boost/date_time.hpp"
#include "boost/date_time/gregorian/gregorian.hpp"

using namespace std;

using namespace boost::gregorian;


int main()

{     

    string s("2001-10-9");

    date d=from_simple_string(s);

    cout << to_simple_string(d) << endl;

    return 0;

}

this code gives three errors

/usr/include/boost/date_time/date_formatting.hpp:44: undefined reference to `boost::gregorian::greg_month::as_short_string() const'

/usr/include/boost/date_time/date_formatting.hpp:49: undefined reference to `boost::gregorian::greg_month::as_long_string() const'

/usr/include/boost/date_time/date_parsing.hpp:67: undefined reference to `boost::gregorian::greg_month::get_month_map_ptrabi:cxx11'

i am using netbeans,ubuntu 16.04 , boost 1.58.0, g++ 5.4

What exactly do the errors mean and how can i fix them ?

Community
  • 1
  • 1

1 Answers1

1

When you compile, add the flag -lboost_date_time to link with the boost date-time library.

There should be a formal way in Netbeans to add a library. Find it, and add boost_date_time to get linked against your executable.

The Quantum Physicist
  • 24,987
  • 19
  • 103
  • 189