Mac 10.8 Qt 4.8.6 error: field has incomplete type



  • I am on Mac 10.8 and have Qt 4.8.6 installed from this website using the precompiled binaries. I have a project that I have compiled on Windows and Linux but cannot get it to compile on the Mac and I am a bit lost. Any help on resolving the error below will be appreciated.

    I run the following command to build the Makefile.

    @qmake -spec macx-g++ project-qt.pro@

    After running make from the command line I get the following error.

    @In file included from src/qt/bitcoin.cpp:5:
    In file included from /Library/Frameworks/QtGui.framework/Versions/4/Headers/QApplication:1:
    In file included from /Library/Frameworks/QtGui.framework/Versions/4/Headers/qapplication.h:45:
    In file included from /Library/Frameworks/QtCore.framework/Headers/qcoreapplication.h:45:
    In file included from /Library/Frameworks/QtCore.framework/Headers/qobject.h:47:
    In file included from /Library/Frameworks/QtCore.framework/Headers/qobjectdefs.h:45:
    In file included from /Library/Frameworks/QtCore.framework/Headers/qnamespace.h:45:
    In file included from /Library/Frameworks/QtCore.framework/Headers/qglobal.h:68:
    In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:626:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/utility:254:9: error: field has incomplete type 'CScript'
    _T2 second;
    ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:1994:27: note: in instantiation of template class
    'std::__1::pair<const CScriptID, CScript>' requested here
    decltype(__is_constructible_test(declval<_Tp>(), declval<_Args>()...))
    ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2043:14: note: in instantiation of template class
    'std::__1::__is_constructible<false, std::__1::allocator<std::__1::pair<const CScriptID, CScript> >>' requested here
    : public __is_constructible<is_scalar<_Tp>::value || is_reference<_Tp>::value,
    ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2069:14: note: in instantiation of template class
    'std::__1::__is_constructible_void_check<false, std::__1::allocator<std::__1::pair<const CScriptID, CScript> >>' requested here
    : public __is_constructible_void_check<__contains_void<_Tp, _Args...>::value
    ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2549:34: note: in instantiation of template class
    'std::__1::is_constructible<std::__1::allocator<std::__1::pair<const CScriptID, CScript> >>' requested here
    : __is_nothrow_constructible<is_constructible<_Tp, _Args...>::value, _Tp, _Args...>
    ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:2671:14: note: in instantiation of template class
    'std::__1::is_nothrow_constructible<std::__1::allocator<std::__1::pair<const CScriptID, CScript> >>' requested here
    : public is_nothrow_constructible<_Tp>
    ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:840:13: note: in instantiation of template class
    'std::__1::is_nothrow_default_constructible<std::__1::allocator<std::__1::pair<const CScriptID, CScript> > >' requested here
    is_nothrow_default_constructible<allocator_type>::value &&
    ^
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__config:332:34: note: expanded from macro 'NOEXCEPT'

    define NOEXCEPT(x) noexcept(x)

                                 ^
    

    src/keystore.h:43:7: note: in instantiation of exception specification for 'map' requested here
    class CBasicKeyStore : public CKeyStore
    ^
    src/serialize.h:28:7: note: forward declaration of 'CScript'
    class CScript;
    ^
    src/keystore.h:116:5: note: implicit default constructor for 'CBasicKeyStore' first required here
    CCryptoKeyStore() : fUseCrypto(false)
    ^@

    The relevant section for Mac in the pro file looks like the following. The project uses c++0x extensions.

    @macx {
    message(Using libc++)
    QMAKE_CXXFLAGS += -std=c++0x
    QMAKE_CXXFLAGS += -stdlib=libc++
    QMAKE_CXXFLAGS += -mmacosx-version-min=10.8
    QMAKE_LFLAGS += -mmacosx-version-min=10.8
    }@


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    To use C++11 you should only need to add
    @CONFIG += c++11@

    To your pro file

    Anyway, what is the CScript class ?



  • The CONFIG += c++11 format is for Qt 5, I am on 4.8.6 and already have c++0x which is enough.

    In the end I back ported my code to c++98. This compiled on every platform except Mac. After looking at making the work involved to make this code compile on Mac and back port it was easy to do the back porting.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.