Windows compiler error: Score::fileInfo() method doesn't exist

• Oct 11, 2016 - 02:42

in file.cpp, compiler threw error for these two "name = ..." lines in this #ifdef :

{syntaxhighlighter C}
#ifdef Q_OS_WIN
if (QSysInfo::WindowsVersion == QSysInfo::WV_XP) {
if (!cs->isMaster())
name = QString("%1/%2-%3").arg(saveDirectory).arg(cs->masterScore()->fileInfo()->completeBaseName()).arg(createDefaultFileName(cs->fileInfo()->completeBaseName()));
else
name = QString("%1/%2").arg(saveDirectory).arg(cs->fileInfo()->completeBaseName());
}
else
#endif
{/syntaxhighlighter}

because fileInfo() is not a property of Score, but is only a property of MasterScore. For some reaon I can't explain, I didn't have any compiler errors a couple days ago when also building on same window smachine. Got it to run now by simply inserting ->masterScore() before the fileInfo(), so now looks like:

{syntaxhighlighter C}
#ifdef Q_OS_WIN
if (QSysInfo::WindowsVersion == QSysInfo::WV_XP) {
if (!cs->isMaster())
name = QString("%1/%2-%3").arg(saveDirectory).arg(cs->masterScore()->fileInfo()->completeBaseName()).arg(createDefaultFileName(cs->masterScore()->fileInfo()->completeBaseName()));
else
name = QString("%1/%2").arg(saveDirectory).arg(cs->masterScore()->fileInfo()->completeBaseName());
}
else
#endif
{/syntaxhighlighter}

Any explainations?


Comments

my best guess is that https://github.com/musescore/MuseScore/pull/2865/files somehow caused the #define Q_OS_WIN to be true while it was previous false. And since it was false before, no one would ever see the error. My windows QT install has the header file qsystemdetection.h which has

#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
#  define Q_OS_WIN
#endif

...maybe that header wasn't included before, somehow? I have no idea why, though. Anyway, it seems that inserting ->masterScore() before the fileInfo() is the correct way to go regardless...I'm going to leave that in my next pr...

In reply to by ericfontainejazz

The guilty one was https://github.com/musescore/MuseScore/commit/0763a5cca4021fc4eed6b859c…
fileInfo() is no more a method of Score but MasterScore. I fixed it in https://github.com/musescore/MuseScore/commit/3c87ca4dc4a72662c876ee845…

(Edit: in fact it took a second commit, and getting my Windows machine up and running again... https://github.com/musescore/MuseScore/commit/5063244dfef3c1ccfb4e5e747…)

Sorry for the inconvenience.

Do you still have an unanswered question? Please log in first to post your question.