나는 다음과 같은 코드를 가지고 있지만이 오류 메시지입니다부스트 날짜/시간
#include <iostream>
#include <string>
#include <locale>
#include "boost/date_time/gregorian/gregorian.hpp"
#include <boost/date_time/gregorian/parsers.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/date_time/posix_time/posix_time_io.hpp>
using namespace boost::posix_time;
using namespace boost::gregorian;
int main(int argc, char *argv[])
{
std::string ds("2011-01-02");
date dt(from_string(ds));
date_facet *f=new date_facet("%Y-%m-%d");
std::locale loc=std::locale(std::locale("en_US"),f);
std::cout.imbue(loc);
time_facet *facet = new time_facet("%Y-%m-%d %H:%M:%S");
std::cout<<second_clock::local_time()<<std::endl;
return 0;
}
컴파일 할 때 로케일 오류가 발생합니다 : 편집 후
In function ‘int main(int, char**)’:
test.cpp:18:1: error: ‘locale’ was not declared in this scope
test.cpp:18:8: error: expected ‘;’ before ‘loc’
오류는 다음과 같습니다
In function ‘int main(int, char**)’:
test.cpp:18:1: error: ‘locale’ was not declared in this scope
을 도움이 될 것입니다? –
내가 추가하면 다음과 같습니다. 치명적인 오류 : boost/locale.hpp : 해당 파일이나 디렉토리가 없습니다. 컴파일이 종료되었습니다. – itcplpl
어떤 버전의 부스트를 사용하고 있습니까? 그것은 단지 1.46+에있는 것 같습니다. http://cppcms.sourceforge.net/boost_locale/html/index.html –