Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7413607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:56:04+00:00 2026-05-29T06:56:04+00:00

I have installed C++SDK that have Qt but when I try compiling a code

  • 0

I have installed C++SDK that have Qt but when I try compiling a code linking QApplication it gives me the error:

Error QApplication: no such file or directory

How do I link these libraries? I searched into the directories and there is a file named QApplication.h; So I tried to link it with -I (linking the directory) but it was still giving me that error.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:56:04+00:00Added an answer on May 29, 2026 at 6:56 am

    To start things off, the error QApplication: no such file or directory means your compiler was not able to find this header. It is not related to the linking process as you mentioned in the question.

    The -I flag (uppercase i) is used to specify the include (headers) directory (which is what you need to do), while the -L flag is used to specify the libraries directory. The -l flag (lowercase L) is used to link your application with a specified library.

    But you can use Qt to your advantage: Qt has a build system named qmake which makes things easier. For instance, when I want to compile main.cpp I create a main.pro file. For educational purposes, let’s say this source code is a simple project that uses only QApplication and QDeclarativeView. An appropriate .pro file would be:

    TEMPLATE += app
    QT += gui declarative
    SOURCES += main.cpp
    

    Then, execute the qmake inside that directory to create the Makefile that will be used to compile your application, and finally execute make to get the job done.

    On my system this make outputs:

    g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_DECLARATIVE_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt_47x/mkspecs/linux-g++ -I. -I/opt/qt_47x/include/QtCore -I/opt/qt_47x/include/QtGui -I/opt/qt_47x/include/QtDeclarative -I/opt/qt_47x/include -I/usr/X11R6/include -I. -o main.o main.cpp
    g++ -Wl,-O1 -Wl,-rpath,/opt/qt_47x/lib -o main main.o -L/opt/qt_47x/lib -L/usr/X11R6/lib -lQtDeclarative -L/opt/qt_47x/lib -lQtScript -lQtSvg -L/usr/X11R6/lib -lQtSql -lQtXmlPatterns -lQtNetwork -lQtGui -lQtCore -lpthread
    

    Note: I installed Qt in another directory –> /opt/qt_47x

    Edit: Qt 5.x and later

    Add QT += widgets to the .pro file and solve this problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Flexbuilder installed, with SDK 3.2. I wanted to try upgrade my SDK
I have Visual Studio 2008 (sp1, .NET 3.5). I have installed Silverlight 3 SDK
i have installed the latest iphone sdk 3.0 beta 5, and trying to submit
I have just installed the Platform SDK for Windows Server 2008 and .NET 3.5
I have installed Xperf performance analyzer from Windows SDK and captured a trace as
I have installed visual studio 2008 sp1, silverlight tools, silverlight sdk, silverlight toolkit 2009
i've installed new sdk 3.2 pre-release wich have iPad simulator, i have tried to
I’ve installed Snow Leopard, have Xcode 3.2 and 3.0 iPhone SDK. I want my
I have installed CherryPy 3.1.0,. Here is what happens when I try to run
I've installed the Android SDK and the ADT plugin, but Android doesn't show up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.