Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Android build error with define



  • Hi,
    my .pro contains:

    VERSION = 1.1.0.0
    QMAKE_TARGET_PRODUCT = "MyApp"
    QMAKE_TARGET_DESCRIPTION = ""
    QMAKE_TARGET_COMPANY = "MyCompany"
    QMAKE_TARGET_COPYRIGHT = "Copyright (c) byMyCompany"
    

    My application builds for Android armeabi-v7a (GCC 4.9, Qt 5.7.1) on Win 10.

    If I add to my pro:

    DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\" \
               APP_PRODUCT=\"\\\"$${QMAKE_TARGET_PRODUCT}\\\"\" \
               APP_COMPANY=\"\\\"$${QMAKE_TARGET_COMPANY}\\\"\" \
               APP_COPYRIGHT=\"\\\"$${QMAKE_TARGET_COPYRIGHT}\\\"\"
    

    Then the app build fails on first file:

    D:\Android\ndk\android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-g++ -c -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove --sysroot=D:\Android\ndk\android-ndk-r11c/platforms/android-9/arch-arm/ -g -g -marm -O0 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DAPP_VERSION="\"1.1.0.0\"" -DAPP_PRODUCT="\"Break Bricks\"" -DAPP_COMPANY="\"Gradient Labs\"" -DAPP_COPYRIGHT="\"Copyright (c) by Gradient Labs\"" -DQT_QML_DEBUG -DQT_PLUGIN -DQT_QUICK_LIB -DQT_MULTIMEDIA_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_SQL_LIB -DQT_CORE_LIB -I../MyApp -I. -IC:/Qt/5.7/android_armv7/include -IC:/Qt/5.7/android_armv7/include/QtQuick -IC:/Qt/5.7/android_armv7/include/QtMultimedia -IC:/Qt/5.7/android_armv7/include/QtGui -IC:/Qt/5.7/android_armv7/include/QtQml -IC:/Qt/5.7/android_armv7/include/QtNetwork -IC:/Qt/5.7/android_armv7/include/QtSql -IC:/Qt/5.7/android_armv7/include/QtCore -I. -I../../../../Android/ndk/android-ndk-r11c/sources/cxx-stl/gnu-libstdc++/4.9/include -I../../../../Android/ndk/android-ndk-r11c/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -I../../../../Android/ndk/android-ndk-r11c/platforms/android-9/arch-arm/usr/include -IC:/Qt/5.7/android_armv7/mkspecs/android-g++ -o a.obj ../MyApp/a.cpp
    /usr/bin/sh: -c: line 0: syntax error near unexpected token `('
    

    Why and how to fix it?


  • Lifetime Qt Champion

    Hi,

    You likely need to also escape the parenthesis. Otherwise you may have surprises.


Log in to reply