Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

boost::posix_time' has not been declared

Tags:

ubuntu

boost

When I try to compile the code with the lines bellow: (I'm using boost 1.51, with gcc 4.6.3 in UBuntu 12.04 LTS 64 bits)

 #include <boost/date_time/posix_time/posix_time.hpp>

 dotFile << "// " << boost::posix_time::second_clock::local_time() << std::endl;

I get this error:

sources/sctg/src/main.cc: In function 'void printDot(sctg::Configuration*, std::string, std::vector<sctg::Task*>*, std::vector<sctg::Event*>*)':
sources/sctg/src/main.cc:1029:31: error: 'boost::posix_time' has not been declared

Any idea how to solve?

like image 638
vvill Avatar asked Nov 25 '25 07:11

vvill


1 Answers

The following minimal test case works for me:

$ cat posix_time.cpp

#include <boost/date_time/posix_time/posix_time.hpp>
#include <iostream>

int main()
{
    std::cout << boost::posix_time::second_clock::local_time() << std::endl;
    return 0;
}

$ g++ -Wall posix_time.cpp 
$ ./a.out 
2013-Jan-31 21:34:31
$

Try this and see if it works on your system. If it fails then I suspect that you have a problem with your boost installation (perhaps an empty header).

like image 50
Paul R Avatar answered Nov 27 '25 22:11

Paul R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!