C++11 and INCLUDE error in iOS



  • Hi guys

    I'm trying tu make an app for iPad 2 with iOS 7.0. In my .pro file I have:

    @
    CONFIG += C++11
    INCLUDE += ./euler
    @

    where euler is a directory from my API, for example...

    Where, when I comment this 2 lines in the .pro, my app work fine in the iOS emulator and into my iPad, but if I don't comment this 2 lines, QtCreator give me the following error:

    @
    The following build commands failed:

    Ld Debug-iphonesimulator/PilarAppBeta.app/PilarAppBeta normal i386

    (1 failure)

    make[1]: *** [iphonesimulator-debug] Error 65

    make: *** [debug-iphonesimulator] Error 2

    Undefined symbols for architecture i386:

    "std::ios_base::Init::Init()", referenced from:

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qqmlbundle.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4regexpobject.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4mm.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4functionobject.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4object.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4debugging.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4codegen.o)

    ...

    "std::ios_base::Init::~Init()", referenced from:

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qqmlbundle.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4regexpobject.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4mm.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4functionobject.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4object.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4debugging.o)

    ___cxx_global_var_init in libQt5Qml_iphonesimulator_debug.a(qv4codegen.o)

    "std::__throw_length_error(char const*)", referenced from:

    std::vector<OwnPtrJSC::Yarr::CharacterClass, std::allocator<OwnPtrJSC::Yarr::CharacterClass > >::_M_insert_aux(__gnu_cxx::__normal_iterator<OwnPtrJSC::Yarr::CharacterClass*, std::vector<OwnPtrJSC::Yarr::CharacterClass, std::allocator<OwnPtrJSC::Yarr::CharacterClass > > >, OwnPtrJSC::Yarr::CharacterClass const&) in libQt5Qml_iphonesimulator_debug.a(YarrPattern.o)

    std::vector<unsigned short, std::allocator<unsigned short> >::_M_insert_aux(__gnu_cxx::__normal_iterator<unsigned short*, std::vector<unsigned short, std::allocator<unsigned short> > >, unsigned short const&) in libQt5Qml_iphonesimulator_debug.a(YarrPattern.o)

    std::vector<JSC::Yarr::PatternTerm, std::allocatorJSC::Yarr::PatternTerm >::_M_insert_aux(__gnu_cxx::__normal_iterator<JSC::Yarr::PatternTerm*, std::vector<JSC::Yarr::PatternTerm, std::allocatorJSC::Yarr::PatternTerm > >, JSC::Yarr::PatternTerm const&) in libQt5Qml_iphonesimulator_debug.a(YarrPattern.o)

    std::vector<OwnPtrJSC::Yarr::PatternDisjunction, std::allocator<OwnPtrJSC::Yarr::PatternDisjunction > >::_M_insert_aux(__gnu_cxx::__normal_iterator<OwnPtrJSC::Yarr::PatternDisjunction*, std::vector<OwnPtrJSC::Yarr::PatternDisjunction, std::allocator<OwnPtrJSC::Yarr::PatternDisjunction > > >, OwnPtrJSC::Yarr::PatternDisjunction const&) in libQt5Qml_iphonesimulator_debug.a(YarrPattern.o)

    std::vector<JSC::Yarr::PatternTerm, std::allocatorJSC::Yarr::PatternTerm >::reserve(unsigned long) in libQt5Qml_iphonesimulator_debug.a(YarrPattern.o)

    std::vector<OwnPtrJSC::Yarr::PatternAlternative, std::allocator<OwnPtrJSC::Yarr::PatternAlternative > >::_M_insert_aux(__gnu_cxx::__normal_iterator<OwnPtrJSC::Yarr::PatternAlternative*, std::vector<OwnPtrJSC::Yarr::PatternAlternative, std::allocator<OwnPtrJSC::Yarr::PatternAlternative > > >, OwnPtrJSC::Yarr::PatternAlternative const&) in libQt5Qml_iphonesimulator_debug.a(YarrPattern.o)

    std::vector<JSC::Yarr::CharacterRange, std::allocatorJSC::Yarr::CharacterRange >::_M_insert_aux(__gnu_cxx::__normal_iterator<JSC::Yarr::CharacterRange*, std::vector<JSC::Yarr::CharacterRange, std::allocatorJSC::Yarr::CharacterRange > >, JSC::Yarr::CharacterRange const&) in libQt5Qml_iphonesimulator_debug.a(YarrPattern.o)

    ...

    ld: symbol(s) not found for architecture i386

    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    17:00:09: The process "/usr/bin/make" exited with code 2.

    Error while building/deploying project PilarAppBeta (kit: iphonesimulator-clang Qt 5.2.1 for iOS)

    When executing step 'Make'

    17:00:09: Elapsed time: 00:04.
    @

    so, my quetion is... how can I make my iOS app compatible with C++11 ??? What Am I doing wrong ??

    best regard

    freddy



  • I haven't tried an iOS app yet, but I know when you build a C++11 OSX app, you need a small 'c' on the config line, not a capital C, like this
    @CONFIG += c++11@

    Maybe it's the same problem for iOS apps?
    (also see "my blog post":http://www.tripleboot.org/?p=101 about this)



  • Hi hskoglund... thanks for answer...

    and yes bro, you are right, i have:

    @
    INCLUDEPATH += ./euler
    CONFIG += c++11
    @

    the above example I hade made a mistake typing. sorry for that...

    When I compile my app for desktop all is fine, but when I try to compile for iOS device, i get the error number 65...

    any other advices ??

    thanks


  • Lifetime Qt Champion

    Hi,

    IIRC, c++11 is not enabled by default on iOS, you would need to build Qt yourself to use it



  • Ty SGaist... for your aclaration !!!

    regards



  • SGaist, might be off topic, but you mean c++11 is not enabled for Qt-flavored iOS apps?
    Because I can use C++11 things like ranged for loops in my "vanilla" iOS (i.e. built with Xcode) apps without problems...


  • Lifetime Qt Champion

    I mean that Qt for iOS looks like not configured to use c++11 (i don't know however if it's intentional or not)



  • Ok maybe something for Qt 5.3's wishlist? Anyway, c++11 support is pretty new in Xcode (since Xcode 5.0 I think).


  • Lifetime Qt Champion

    At least worth to ask on the interest mailing list


  • Lifetime Qt Champion

    If I saw things correctly, the c++11 switch is now enabled (so it should be in for Qt 5.3)

    If I understood things correctly it was due to the minimum iOS version supported which will now be iOS 5.0



  • Neat, I should download 5.3 and give it a try.

    (It's easy to get tired of those longwinded method names in Objective-C, if Qt can give me 100% C++11 in iOS, that could save my fingers a bit of typing pain :-)


Log in to reply
 

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