Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Qt 5.10.1, QCoreApplication::applicationFilePath: Please instantiate the QApplication object first

    General and Desktop
    1
    1
    1636
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      Athius last edited by Athius

      Hello everyone,

      I'm working on macOS 10.13.6 with clang (Apple LLVM version 10.0.0 (clang-1000.11.45.2)).

      I try to get the application running path. To do this, I use QCoreApplication::applicationFilePath() static method like this:

      #include <QApplication>
      #include <QDebug>
      
      int main(int argc, char * argv[])
      {
            QApplication app(argc, argv);
           
            qDebug() << app.applicationFilePath();
            return app.exec();
      }
      

      The code compile correctly but when I launch this app, I have the message:

      QCoreApplication::applicationFilePath: Please instantiate the QApplication object first
      

      Does anyone have the same behavior? How to fix it?

      Thank you
      Romain

      Edit: I tried this code using Qt 5.11.1 and it's working but unfortunately my application must be built with compatibility macOS 10.10 and Qt 5.11.* minimum compatibility is macOS 10.11

      Edit2: I found the solution: I had some link to another Qt version....

      1 Reply Last reply Reply Quote 0
      • First post
        Last post