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. Can't build official Qt tut code using Qt Creator
Forum Updated to NodeBB v4.3 + New Features

Can't build official Qt tut code using Qt Creator

Scheduled Pinned Locked Moved General and Desktop
6 Posts 4 Posters 5.2k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    Jaggid1x
    wrote on last edited by
    #1

    I can't build this simple code at the very beginning of the Qt tutorial

    @
    1 #include <QApplication>
    2 #include <QTextEdit>
    3
    4 int main(int argv, char **args)
    5 {
    6 QApplication app(argv, args);
    7
    8 QTextEdit textEdit;
    9 textEdit.show();
    10
    11 return app.exec();
    12 }
    @

    from here: http://doc.qt.nokia.com/4.7/gettingstartedqt.html

    It tells me
    QApplication.h No such file or directory
    QTextEdit.h No such file or directory

    I can only imagine there's something wrong with my settings, but I'm using Qt Creator and haven't messed with anything.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dialingo
      wrote on last edited by
      #2

      It looks like you called
      @qmake main.cpp@

      use qmake for the .pro file to get a Makefile
      use make to run the Makefile
      This will give you an executable for your platform.

      Read the relevant part of the link you specified again :-)

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tomma
        wrote on last edited by
        #3

        Can you paste your .pro -file?
        It should look something like:
        @
        TEMPLATE = app
        TARGET =
        SOURCES += main.cpp
        @

        Also which version of Qt Creator are you using? And Qt?

        Did you copy those line numbers to file or just some paste error?

        Edit:
        Yeah OK faster reply was right =)
        Nothing wrong with code

        1 Reply Last reply
        0
        • R Offline
          R Offline
          romankr
          wrote on last edited by
          #4

          @#include <QTextEdit>@
          angle-bracket. That means that g++ will be called with -I flag.
          For example, set of instructions, produced by qt creator:
          @g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\qt\include\QtCore" -I"..\qt\include\QtGui" -I"..\qt\include" -I"..\qt\include\ActiveQt" -I"debug" -I"." -I"..\test" -I"." -I"..\qt\mkspecs\win32-g++" -o debug\mainwindow.o ..\test\mainwindow.cpp @
          that was how include works under the hood. Why?

          I'm sure that you

          1. haven't some qt libs (or all - installed only creator, not libs)
          2. have wrong qtreator settings (a wrong QT PATH) -> it's searching for includes in wrong directory.
          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jaggid1x
            wrote on last edited by
            #5

            I'm guessing it's #2 since I found QApplication in the SDK folders, but where do I set the lib directory? This is the only window I found that seems in any way associated with a lib directory:

            http://i.imgur.com/G7izb.jpg

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jaggid1x
              wrote on last edited by
              #6

              Okay, I got it. Googled a bit to look for a way to add includes and libs onto Qt Creator. Didn't know you had to add them into the .pro file for each project =/ . Thanks for your help.

              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