저는 C++ 프로젝트에서 작업 중이며 boost 1.46 (시냅틱이 Oneiric에 설치하는 기본 버전)과 호환되도록 몇 가지 변경을했지만, 그것을 이전 버전의 부스트로 올바르게 컴파일하십시오. 사용중인 버전 향상에 따라 다른 코드를 어떻게 가질 수 있습니까? configure 파일 (autoconf에 의해 생성 됨)은 어느 변수를 나타낼 지 #DEFINE합니까? 또한이 특정 변경 사항이 도입 된 버전이 무엇인지에 대해서는 확신 할 수 없습니다.C++ 프로젝트 여러 버전의 부스트와의 호환성
여기 부스트 버전을 기반으로, 내가 통합하려는 두 가지 버전은 diff의 :
diff --git a/src/util/Misc.cpp b/src/util/Misc.cpp
index 467144d..a9738aa 100644
--- a/src/util/Misc.cpp
+++ b/src/util/Misc.cpp
@@ -28,7 +28,7 @@ void MiscUtil::FindProgramDir(int argc, char* argv[])
{
if (argc == 0 || argv == 0)
return;
- programDir = path(argv[0], native).branch_path();
+ programDir = path(argv[0]).branch_path();
}
void MiscUtil::WordToBytes(unsigned word, byte* out)
@@ -70,7 +70,7 @@ std::string MiscUtil::OpenFile(std::string name, std::ifstream& f)
{
path p = programDir/name;
p.normalize();
- programDirFile = p.native_file_string();
+ programDirFile = p.string();
f.open(programDirFile.c_str());
if (f.is_open())
return programDirFile;
@@ -78,7 +78,7 @@ std::string MiscUtil::OpenFile(std::string name, std::ifstream& f)
{
path p = boost::filesystem::path(ABS_TOP_SRCDIR)/"share"/name;
p.normalize();
- absFile = p.native_file_string();
+ absFile = p.string();
f.open(absFile.c_str());
if (f.is_open())
return absFile;
@@ -86,7 +86,7 @@ std::string MiscUtil::OpenFile(std::string name, std::ifstream& f)
{
path p = boost::filesystem::path(DATADIR)/name;
p.normalize();
- dataFile = p.native_file_string();
+ dataFile = p.string();
f.open(dataFile.c_str());
if (f.is_open())
return dataFile;
나는 autoconf를 잘 알고 아니에요이는 다른 사람의입니다, 내 코드가 아닙니다. 여기에 무슨 일이 일어나고 있는지에 대한 설명은 감사하겠습니다.
감사
것 같습니다. boost V3는 어떤 버전입니까? 1.46입니까 아니면 더 빠릅니까? – dspyz
오, 알겠습니다 : http://www.boost.org/doc/libs/1_49_0/libs/filesystem/v3/doc/release_history.html – dspyz