Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt 5.10.1, QCoreApplication::applicationFilePath: Please instantiate the QApplication object first

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

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 2.1k Views
  • 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 Offline
    A Offline
    Athius
    wrote on last edited by Athius
    #1

    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
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved