vvill
vvill

Reputation: 1118

boost::posix_time' has not been declared

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?

Upvotes: 3

Views: 1940

Answers (1)

Paul R
Paul R

Reputation: 212979

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).

Upvotes: 2

Related Questions