1
votes

I am getting the following compilation error when I include boost/date_time/posix_time/posix_time.hpp in my c++ code

/usr/include/boost/date_time/date_facet.hpp:560: error: declaration of ‘void boost::date_time::date_input_facet <date_type, CharT, InItrT>::special_values_parser(boost::date_time::special_values_parser <date_type, charT>)’
/usr/include/boost/date_time/special_values_parser.hpp:34: error: changes meaning of ‘special_values_parser’ from ‘class boost::date_time::special_values_parser <date_type, charT>’

I think that it's just the call to include which is causing the problem . I have the following code

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

class Chrono {
    public: Chrono() : _startTime(boost::posix_time::microsec_clock::local_time()) { ; }
    void reset() { _startTime = boost::posix_time::microsec_clock::local_time() ; }     
    boost::posix_time::time_duration elapsed() const { 
      return (boost::posix_time::microsec_clock::local_time() - _startTime) ; 
    } 
    boost::posix_time::ptime _startTime ; 
}; 

I use gcc-4.3.4 and boost x86_64 0:1.39.0-9.el5 library

Does anyone has an idea on this ?

Thanks in advance

1
post a minimally complete example demonstrating the problemSam Miller

1 Answers

0
votes

Regarding your first question: Have you tried with a more recent compiler? gcc-4.3.4 is positively ancient... I tried with gcc-4.4.6 and boost-1.46 and this combination works fine. Also, the error message you posted is not complete, it looks like at least half of it is missing.

As to the second question (the one about your CMakeLists.txt not working): Did you try with a clean binary tree? If the cached version (Boost_<XXX>_LIBRARY entries in the CMakeCache.txt file) does not match the version in your CMakeLists.txt file, you will get this kind of error message. This can happen if you ran CMake, it found the old version, and then you added the VERSION requirement. In that case, the cached entries won't be purged, and you end up with a mess.