Fatal error: QObject: No such file or directory



  • Hi guys, I developed an android application using Android studio and now I would like to include a native part. So I start developing this part using Qt and now I would like to include sources files in my application.

    My problem is I got the following errors : fatal error: QObject: No such file or directory

    Notice : I use the : android-ndk-r10e and my Android.mk file looks like :

    LOCAL_PATH := $(call my-dir)
    
    include $(CLEAR_VARS)
    LOCAL_MODULE := qt-signaux
    
    LOCAL_SRC_FILES += com_example_qtsignaux_Library.cpp
    LOCAL_SRC_FILES += Emitter.cpp
    
    TARGET_ARCH_ABI += armeabi
    #Allows to enable android log
    LOCAL_LDLIBS := -llog
    
    include $(BUILD_SHARED_LIBRARY)
    
    

    Thks in advance guys


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Since you're not using Qt's qmake .pro file your going to have to tell your script where to find Qt's headers and libraries as well as run the tools like moc or rcc by hand.

    I don't know how to do that from an Android.mk file though.



  • @SGaist Hi SGaist. Thanks for your reply.Might be possible to generate a shared library usable in Android using qt and qmake? I mean develop my native code as a qt project, export it as a library and then include it in my android project?


  • Lifetime Qt Champion

    Technically Qt is a set of shared libraries that you use to build an Android application so possible I'd say yes but I don't know how to do it using Android's NDK original build system.



  • I finally found my issue. My include path did not point to the great folder (the one containing the QObject header)

    To fix it I used the include path flag with the ndk-build command



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