Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ project Compatibility with multiple versions of boost
    text
    copied!<p>I'm working on a C++ project and I made a couple changes to make it compatible with boost 1.46 (the default version that synaptic installs on Oneiric), but I'd like to also make it compile correctly with the old version of boost. How can I have different code based on the version boost being used. Does the configure file (generated by autoconf) #DEFINE some variable to indicate which one? Also, I'm not entirely sure which version where this particular change was introduced.</p> <p>Here's the diff for the two versions I want to integrate, based on boost version:</p> <pre><code>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&amp; 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&amp; 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&amp; 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; </code></pre> <p>I'm not very familiar with autoconf and this isn't my code, it's someone else's. Any explanation of what's going on here would be appreciated.</p> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload