On cygwin, when compiling lyx_cb.C and a few other files, I get the following error:
if g++ -DHAVE_CONFIG_H -I. -I../../src -I. -I../../boost -Wno-uninitialized -O2 -MT lyx_cb.o -MD -MP -MF ".deps/lyx_cb.Tpo" -c -o lyx_cb.o ../../src/lyx_cb.C; \ then mv -f ".deps/lyx_cb.Tpo" ".deps/lyx_cb.Po"; else rm -f ".deps/lyx_cb.Tpo"; exit 1; fi ../../src/lyx_cb.C:70: error: `Path' is already declared in this scope make: *** [lyx_cb.o] Error 1 This is due to the following code in boost/boost/filesystem/operations.hpp: # ifndef BOOST_FILESYSTEM_NARROW_ONLY # define BOOST_FS_FUNC(BOOST_FS_TYPE) \ template<class Path> typename boost::enable_if<is_basic_path<Path>, \ BOOST_FS_TYPE>::type # define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) \ template<class Path> inline typename boost::enable_if<is_basic_path<Path>, \ BOOST_FS_TYPE>::type # define BOOST_FS_TYPENAME typename # else # define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE # define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE typedef boost::filesystem::path Path; # define BOOST_FS_TYPENAME # endif The problem occurs when BOOST_FILESYSTEM_NARROW_ONLY is defined as in this case the "typedef boost::filesystem::path Path;" kicks in. The attached patch solves it by renaming class Path as CurrentPath. Please, let me know if there are any objections. The alternative would be deleting "using lyx::support::Path" and substituting "Path" with "lyx::support::Path" in those files where the problem occurs. -- Enrico
Log: Rename class Path as CurrentPath to avoid a name clash in boost 1.34 * src/lyx_cb.C: * src/insets/insetbibtex.C: * src/insets/ExternalSupport.C: * src/insets/ExternalTemplate.C: * src/converter.C: * src/buffer.C: * src/lyxfunc.C: * src/vc-backend.C: * src/frontends/controllers/tex_helpers.C: * src/support/path.[Ch]: * src/lyx_main.C: rename Path as CurrentPath.
Index: src/lyx_cb.C =================================================================== --- src/lyx_cb.C (revisione 14981) +++ src/lyx_cb.C (copia locale) @@ -67,7 +67,7 @@ using lyx::support::makeAbsPath; using lyx::support::makeDisplayPath; using lyx::support::onlyFilename; using lyx::support::onlyPath; -using lyx::support::Path; +using lyx::support::CurrentPath; using lyx::support::package; using lyx::support::removeAutosaveFile; using lyx::support::rename; @@ -443,7 +443,7 @@ void reconfigure(BufferView * bv) bv->buffer()->message(_("Running configure...")); // Run configure in user lyx directory - Path p(package().user_support()); + CurrentPath p(package().user_support()); string const configure_command = package().configure_command(); Systemcall one; one.startscript(Systemcall::Wait, configure_command); Index: src/insets/insetbibtex.C =================================================================== --- src/insets/insetbibtex.C (revisione 14981) +++ src/insets/insetbibtex.C (copia locale) @@ -48,7 +48,7 @@ using lyx::support::latex_path; using lyx::support::ltrim; using lyx::support::makeAbsPath; using lyx::support::makeRelPath; -using lyx::support::Path; +using lyx::support::CurrentPath; using lyx::support::prefixIs; using lyx::support::removeExtension; using lyx::support::rtrim; @@ -296,7 +296,7 @@ int InsetBibtex::latex(Buffer const & bu vector<string> const InsetBibtex::getFiles(Buffer const & buffer) const { - Path p(buffer.filePath()); + CurrentPath p(buffer.filePath()); vector<string> vec; Index: src/insets/ExternalSupport.C =================================================================== --- src/insets/ExternalSupport.C (revisione 14981) +++ src/insets/ExternalSupport.C (copia locale) @@ -174,7 +174,7 @@ string const doSubstitution(InsetExterna string const filepath = support::isFileReadable(file) ? buffer.filePath() : m_buffer->temppath(); - support::Path p(filepath); + support::CurrentPath p(filepath); if (support::isFileReadable(file)) contents = support::getFileContents(file); Index: src/insets/ExternalTemplate.C =================================================================== --- src/insets/ExternalTemplate.C (revisione 14981) +++ src/insets/ExternalTemplate.C (copia locale) @@ -228,7 +228,7 @@ TemplateManager::getPreambleDefByName(st void TemplateManager::readTemplates(string const & path) { - support::Path p(path); + support::CurrentPath p(path); enum TemplateTags { TM_PREAMBLEDEF = 1, Index: src/converter.C =================================================================== --- src/converter.C (revisione 14981) +++ src/converter.C (copia locale) @@ -43,7 +43,7 @@ using lyx::support::libScriptSearch; using lyx::support::makeRelPath; using lyx::support::onlyFilename; using lyx::support::onlyPath; -using lyx::support::Path; +using lyx::support::CurrentPath; using lyx::support::prefixIs; using lyx::support::quoteName; using lyx::support::split; @@ -327,7 +327,7 @@ bool Converters::convert(Buffer const * OutputParams runparams; runparams.flavor = getFlavor(edgepath); string path = onlyPath(from_file); - Path p(path); + CurrentPath p(path); // empty the error list before any new conversion takes place. errorList.clear(); @@ -405,7 +405,7 @@ bool Converters::convert(Buffer const * Systemcall one; int res; if (conv.original_dir) { - Path p(buffer->filePath()); + CurrentPath p(buffer->filePath()); res = one.startscript(type, command); } else res = one.startscript(type, command); Index: src/buffer.C =================================================================== --- src/buffer.C (revisione 14981) +++ src/buffer.C (copia locale) @@ -113,7 +113,7 @@ using lyx::support::makeDisplayPath; using lyx::support::makeLatexName; using lyx::support::onlyFilename; using lyx::support::onlyPath; -using lyx::support::Path; +using lyx::support::CurrentPath; using lyx::support::quoteName; using lyx::support::removeAutosaveFile; using lyx::support::rename; @@ -1076,7 +1076,7 @@ int Buffer::runChktex() string const path = temppath(); string const org_path = filePath(); - Path p(path); // path to LaTeX file + CurrentPath p(path); // path to LaTeX file message(_("Running chktex...")); // Generate the LaTeX file if neccessary Index: src/lyxfunc.C =================================================================== --- src/lyxfunc.C (revisione 14981) +++ src/lyxfunc.C (copia locale) @@ -118,7 +118,7 @@ using lyx::support::isStrInt; using lyx::support::makeAbsPath; using lyx::support::makeDisplayPath; using lyx::support::package; -using lyx::support::Path; +using lyx::support::CurrentPath; using lyx::support::quoteName; using lyx::support::rtrim; using lyx::support::split; @@ -931,7 +931,7 @@ void LyXFunc::dispatch(FuncRequest const // Push directory path. string const path = buffer->temppath(); - Path p(path); + CurrentPath p(path); // there are three cases here: // 1. we print to a file @@ -1346,7 +1346,7 @@ void LyXFunc::dispatch(FuncRequest const } case LFUN_PREFERENCES_SAVE: { - Path p(package().user_support()); + CurrentPath p(package().user_support()); lyxrc.write("preferences", false); break; } Index: src/vc-backend.C =================================================================== --- src/vc-backend.C (revisione 14981) +++ src/vc-backend.C (copia locale) @@ -30,7 +30,7 @@ using lyx::support::addPath; using lyx::support::contains; using lyx::support::onlyFilename; using lyx::support::onlyPath; -using lyx::support::Path; +using lyx::support::CurrentPath; using lyx::support::quoteName; using lyx::support::rtrim; using lyx::support::split; @@ -57,7 +57,7 @@ int VCS::doVCCommand(string const & cmd, { lyxerr[Debug::LYXVC] << "doVCCommand: " << cmd << endl; Systemcall one; - Path p(path); + CurrentPath p(path); int const ret = one.startscript(Systemcall::Wait, cmd); return ret; } Index: src/frontends/controllers/tex_helpers.C =================================================================== --- src/frontends/controllers/tex_helpers.C (revisione 14981) +++ src/frontends/controllers/tex_helpers.C (copia locale) @@ -41,7 +41,7 @@ using support::getVectorFromString; using support::libFileSearch; using support::onlyFilename; using support::package; -using support::Path; +using support::CurrentPath; using support::quoteName; using support::split; using support::Systemcall; @@ -52,7 +52,7 @@ namespace frontend { void rescanTexStyles() { // Run rescan in user lyx directory - Path p(package().user_support()); + CurrentPath p(package().user_support()); string const command = libFileSearch("scripts", "TeXFiles.py"); Systemcall one; int const status = one.startscript(Systemcall::Wait, @@ -69,7 +69,7 @@ void rescanTexStyles() void texhash() { // Run texhash in user lyx directory - Path p(package().user_support()); + CurrentPath p(package().user_support()); //path to texhash through system Systemcall one; Index: src/support/path.h =================================================================== --- src/support/path.h (revisione 14981) +++ src/support/path.h (copia locale) @@ -20,25 +20,25 @@ namespace lyx { namespace support { /** - * Path - utility closs for stackable working directories + * CurrentPath - utility closs for stackable working directories * * You can use a local variable of this type to temporarily * change to a directory as the cwd, for example : * * if (blah) { - * Path p("/tmp/blah"); + * CurrentPath p("/tmp/blah"); * ... * } * * At the end of p's scope the cwd is reset to its previous value. */ -class Path : boost::noncopyable { +class CurrentPath : boost::noncopyable { public: /// change to the given directory - explicit Path(std::string const & path); + explicit CurrentPath(std::string const & path); /// set cwd to the previous value if needed - ~Path(); + ~CurrentPath(); /// set cwd to the previous value if needed int pop(); @@ -50,13 +50,13 @@ private: }; // To avoid the wrong usage: -// Path("/tmp"); // wrong -// Path p("/tmp"); // right +// CurrentPath("/tmp"); // wrong +// CurrentPath p("/tmp"); // right // we add this macro: /// // With boost 1.34 this is not usable anymore //#ifndef PATH_C -//#define Path(x) unnamed_Path; +//#define CurrentPath(x) unnamed_Path; //#endif // Tip gotten from Bobby Schmidt's column in C/C++ Users Journal Index: src/support/path.C =================================================================== --- src/support/path.C (revisione 14981) +++ src/support/path.C (copia locale) @@ -23,7 +23,7 @@ using std::string; namespace lyx { namespace support { -Path::Path(string const & path) +CurrentPath::CurrentPath(string const & path) : popped_(false) { if (!path.empty()) { @@ -38,13 +38,13 @@ Path::Path(string const & path) } -Path::~Path() +CurrentPath::~CurrentPath() { if (!popped_) pop(); } -int Path::pop() +int CurrentPath::pop() { if (popped_) { // should throw an exception Index: src/lyx_main.C =================================================================== --- src/lyx_main.C (revisione 14981) +++ src/lyx_main.C (copia locale) @@ -71,7 +71,7 @@ using lyx::support::getEnv; using lyx::support::i18nLibFileSearch; using lyx::support::libFileSearch; using lyx::support::package; -using lyx::support::Path; +using lyx::support::CurrentPath; using lyx::support::prependEnvPath; using lyx::support::rtrim; using lyx::support::Systemcall; @@ -133,7 +133,7 @@ void reconfigureUserLyXDir() string const configure_command = package().configure_command(); lyxerr << lyx::to_utf8(_("LyX: reconfiguring user directory")) << endl; - Path p(package().user_support()); + CurrentPath p(package().user_support()); Systemcall one; one.startscript(Systemcall::Wait, configure_command); lyxerr << "LyX: " << lyx::to_utf8(_("Done!")) << endl;