Important: Please read the Qt Code of Conduct -

Fail to build qt 5.2.1 static on windows 7 using tdm-gcc

  • hello
    i fail to build qt on w7 and i get this error
    building using qtsdk gcc goes fine

    qml\qqmlengine.cpp: In function 'QString shellNormalizeFileName(const QString&)':
    qml\qqmlengine.cpp:2299:5: error: 'PIDLIST_ABSOLUTE' was not declared in this scope
    qml\qqmlengine.cpp:2299:22: error: expected ';' before 'file'
    In file included from c:\qt\tdm-gcc\include\winnt.h:34:0,
    from c:\qt\tdm-gcc\include\windef.h:253,
    from c:\qt\tdm-gcc\include\windows.h:48,
    from C:\Qt\Qt5.2.1\Static\src\qt-everywhere-opensource-src-5.2.1\qtbase\include\QtCore/../../src/coreli
    from C:\Qt\Qt5.2.1\Static\src\qt-everywhere-opensource-src-5.2.1\qtbase\include\QtCore/qt_windows.h:1,
    from C:\Qt\Qt5.2.1\Static\src\qt-everywhere-opensource-src-5.2.1\qtbase\mkspecs\win32-g++/qplatformdefs
    from C:\Qt\Qt5.2.1\Static\src\qt-everywhere-opensource-src-5.2.1\qtbase\include\QtCore\5.2.1\QtCore/pri
    from C:\Qt\Qt5.2.1\Static\src\qt-everywhere-opensource-src-5.2.1\qtbase\include\QtCore\5.2.1\QtCore/pri
    from qml\qqmlengine.cpp:83:
    qml\qqmlengine.cpp:2300:49: error: 'file' was not declared in this scope
    if (FAILED(SHParseDisplayName(nameC, NULL, &file, 0, NULL)))
    qml\qqmlengine.cpp:2303:30: error: 'file' was not declared in this scope
    if (!SHGetPathFromIDList(file, buffer))
    Makefile.Release:30581: recipe for target '.obj/release/qqmlengine.o' failed
    mingw32-make[4]: *** [.obj/release/qqmlengine.o] Error 1
    mingw32-make[4]: Leaving directory 'C:/Qt/Qt5.2.1/Static/src/qt-everywhere-opensource-src-5.2.1/qtdeclarative/src/qml'
    Makefile:34: recipe for target 'release' failed
    mingw32-make[3]: *** [release] Error 2
    mingw32-make[3]: Leaving directory 'C:/Qt/Qt5.2.1/Static/src/qt-everywhere-opensource-src-5.2.1/qtdeclarative/src/qml'
    Makefile:44: recipe for target 'sub-qml-make_first-ordered' failed
    mingw32-make[2]: *** [sub-qml-make_first-ordered] Error 2
    mingw32-make[2]: Leaving directory 'C:/Qt/Qt5.2.1/Static/src/qt-everywhere-opensource-src-5.2.1/qtdeclarative/src'
    Makefile:41: recipe for target 'sub-src-make_first' failed
    mingw32-make[1]: *** [sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.2.1/Static/src/qt-everywhere-opensource-src-5.2.1/qtdeclarative'
    Makefile:212: recipe for target 'module-qtdeclarative-make_first' failed
    mingw32-make: *** [module-qtdeclarative-make_first] Error 2

  • I have same error! I try to build Qt 5.2.1 for a whole week, buy every time have this error. Someone can help to solve this problem?
    (sorry for my English grammar)

  • one year later, the problem is still present.
    the turn around found by defining PIDLIST_ABSOLUTE as a pointer to LPITEMIDLIST is not enought here. Should not deference the return of SHParseDisplayName (with &file).
    turnaround found when trying to build under mingw , gcc version 4.8.1
    but not necessary under Qt's mingw gcc 4.9.1 found in actual Qt5.4.1 distribution

    my mod to pass this point :
    in fileutils.cpp line 298 :

    #ifdef Q_OS_WIN
    	const QString nativeSeparatorName(QDir::toNativeSeparators(name));
    	const LPCTSTR nameC = reinterpret_cast<LPCTSTR>(nativeSeparatorName.utf16()); // MinGW
    	LPITEMIDLIST file;//<<<<<<<<<< direct use of LPITEMIDLIST 
    	HRESULT hr = SHParseDisplayName(nameC, NULL, file, 0, NULL);//<<<<<<<< instead of &file
    	if (FAILED(hr))
    		return name;
    	TCHAR buffer[MAX_PATH];
    	if (!SHGetPathFromIDList(file, buffer))
    		return name;
    	return QDir::fromNativeSeparators(QString::fromUtf16(reinterpret_cast<const ushort *>(buffer)));
    #else // Filesystem is case-insensitive only on Windows
    	return name;

Log in to reply