Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [Moved] Newbie problems with QT Creator
Forum Updated to NodeBB v4.3 + New Features

[Moved] Newbie problems with QT Creator

Scheduled Pinned Locked Moved Qt Creator and other tools
13 Posts 5 Posters 5.8k 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.
  • M Offline
    M Offline
    misterwalrus
    wrote on 13 Jul 2011, 18:16 last edited by
    #2

    I forgot to include version info: Qt Creator: 2.2.1 , based on qt 4.7.4 (32 bit)
    Thank you

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on 13 Jul 2011, 19:11 last edited by
      #3

      You provide no way to quit your application gracefully, this is why it either gets killed (by closing the console window) or terminated (by pressing CTRL-C) - which results in an return code not equal to zero.

      To quit an application you have to use "QCoreApplication::quit()":http://doc.qt.nokia.com/latest/qcoreapplication.html#quit or "QCoreApplication::exit()":http://doc.qt.nokia.com/latest/qcoreapplication.html#exit.

      @
      #include <QtCore/QCoreApplication>
      #include <QtCore/QTimer>

      int main(int argc, char *argv[])
      {
      QCoreApplication a(argc, argv);

      QTimer::singleShot(0, &a, SLOT(quit())); // invokes QCoreApplication::quit() 
                                               // as soon as the event loop
                                               // starts (a.exec(&#41; is called&#41;.
                                                           
      
      return a.exec(&#41;;
      

      }
      @
      ... shows what one would expect - a return value of zero.

      FYI: If you wrap your code between @ tags it gets formatted properly.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on 13 Jul 2011, 19:17 last edited by
        #4

        Hi

        welcome in Qt DevNet.

        Some organisation stuff. You should enclose your code example in '@'. One at teh begin and one at the end of the code section. Otherwise it looks a bit messy. For your small example it is not a problem.
        Furthermore, it is Qt in this forum. QT means Quick Time.

        I am probably not of much help since I am using visual studio on windows and the creator only on linux.

        However, are you trying to run it with the debugger? Than your error may stem from a missing debugger. Make sure that you try to start without debugger as the first step then.

        Edit: was too slow ;-) But Lukas has more experience there.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          misterwalrus
          wrote on 13 Jul 2011, 19:23 last edited by
          #5

          Thank you very much for SUCH a quick feeback. I am impressed!.

          I have an update to the case. The simple code I pasted before...it works...My fault.
          The problem is that I was struggling with another very simple piece of code, using opencv that was throwing the same error (1073741511). Trying to see where the problem was, I created another project without closing the initial one. It seems that it was picking something from the first one.
          Now, I closed teh opencv project and the simple one run from inside QT, both in release and/or debug mode.

          Now, it seems that the problem is with the opencv code. Because it is a very basic example I will post it here:

          (following your advice:)
          @
          #include <QtCore/QCoreApplication>
          #include "opencv2/highgui/highgui.hpp"
          #include "opencv2/core/core.hpp"

          int main(int argc, char *argv[])
          {
          QCoreApplication a(argc, argv);
          cv::namedWindow("test"); //<<----only opencv function used
          return a.exec();
          }
          @

          Application output:
          Starting C:\myQT\test2-build-desktop\debug\test2.exe...
          C:\myQT\test2-build-desktop\debug\test2.exe exited with code -1073741511

          --

          Please advise,
          Thank you very much,
          andres

          [EDIT: code formatting fixed, Volker]

          1 Reply Last reply
          0
          • M Offline
            M Offline
            misterwalrus
            wrote on 13 Jul 2011, 19:28 last edited by
            #6

            I should had said that the opencv code works OK, if ran from the command prompt, after build for release mode.
            Thank you very much,
            Andres

            1 Reply Last reply
            0
            • K Offline
              K Offline
              koahnig
              wrote on 13 Jul 2011, 19:33 last edited by
              #7

              [quote author="misterwalrus" date="1310585011"]
              @
              #include <QtCore/QCoreApplication>
              #include "opencv2/highgui/highgui.hpp"
              #include "opencv2/core/core.hpp"

              int main(int argc, char *argv[])
              {
              QCoreApplication a(argc, argv);
              cv::namedWindow("test"); //<<----only opencv function used
              return a.exec();
              }
              @
              [/quote]

              Your additional text after the at-sign did corrupt the feature. I have deleted this text, but you could have added also a space.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              0
              • M Offline
                M Offline
                misterwalrus
                wrote on 13 Jul 2011, 19:36 last edited by
                #8

                Thank you, I realized that I messed up with the formatting after hitting Enter..sorry

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  koahnig
                  wrote on 13 Jul 2011, 19:41 last edited by
                  #9

                  No problem. here is an "introduction on writing posts in DevNet":http://developer.qt.nokia.com/wiki/ForumHelp

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    misterwalrus
                    wrote on 13 Jul 2011, 19:53 last edited by
                    #10

                    Hello,
                    this is the pro file I am using for the above code:
                    @
                    #-------------------------------------------------

                    Project created by QtCreator 2011-07-13T13:52:45

                    #-------------------------------------------------

                    QT += core

                    QT -= gui

                    TARGET = test2
                    CONFIG += console
                    CONFIG -= app_bundle

                    TEMPLATE = app

                    SOURCES += main.cpp

                    INCLUDEPATH += /OpenCV2.3/install/include

                    LIBS += /OpenCV2.3/install/lib/libopencv_calib3d230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_contrib230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_core230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_features2d230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_flann230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_gpu230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_highgui230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_imgproc230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_legacy230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_ml230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_objdetect230.dll.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_ts230.a
                    LIBS += /OpenCV2.3/install/lib/libopencv_video230.dll.a
                    @

                    As I said, this example is runnable from command prompt.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      misterwalrus
                      wrote on 13 Jul 2011, 21:29 last edited by
                      #11

                      Update,
                      Just by inspiration I changed the Tool chain (Options ->Tool chains) and the compiler path I added:

                      c:\mingw\bin\g++.exe (mingw was installed before installing QT sdk, by using mingw-get-inst-2010530 from sourceforge mingw page)

                      In the Debugger I added: <qtsdk_root>\phythongdb\phthon_2.7based\gdb-i686-pc-mingw32.exe.

                      And that changed has provided a good break to my effort. Now I can run and debug from inside QT Creator IDE.

                      One thing that still does not work and I have really no clue why:
                      running the project from inside Qt creator using the release version.

                      Why does not work from inside QT creator when it runs from the command prompt?

                      Best regards,
                      Andres

                      UPDATE NOTE:
                      I really dont want to gave up with QT/OpenCV but is just driving me crazy
                      ...I have created two different windows 7 virtual machines to go step by step through the installation progress. I was trying to write a fail safe installation procedure.
                      The only thing I have nailed down is the Building part, I know exactly how to configure my .pro file in order to have Build succesfully.
                      I always can produce a release version that works in my PC...I haven't looked at Deploying yet. But running or debugging from inside Qt creator is not working at all (I mean when using the opencv libraries...stdio samples work Ok.

                      I have set the tool chain to use the mingw g++ that comes with QTsdk, and point the debugger to use the python2.7 gdb that comes also with the Qtsdk...It does not work.
                      I have also tried the mingw/g++ that comes with the QT open source libraries...nothing....With the one that comes with the mingw installed from sourceforge...nothing...

                      The error is always the same exit code (from original post).

                      Is there any suggestion? Or a pointer to a good installation procedure ?

                      Best regards,

                      PS: Sorry for my bad posting style.. I am learning to use the forum. Thanks for all recommendations, not only the technical ones but also the organizational ones.

                      1 Reply Last reply
                      0
                      • E Offline
                        E Offline
                        Eddy
                        wrote on 14 Jul 2011, 04:30 last edited by
                        #12

                        You could have a look at your project settings in Qt Creator. Compare the working one (debug) with the release project settings. I guess there is a path wrong.

                        You could also compare it with the paths set in console.

                        Qt Certified Specialist
                        www.edalsolutions.be

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          changsheng230
                          wrote on 14 Jul 2011, 04:35 last edited by
                          #13

                          It will be better if you add the additional notes using edit the existing one rather than appending a new reply next time.
                          [quote author="misterwalrus" date="1310580984"]I forgot to include version info: Qt Creator: 2.2.1 , based on qt 4.7.4 (32 bit)
                          Thank you[/quote]

                          http://developer.qt.nokia.com/forums/viewthread/7753/#

                          Chang Sheng
                          常升

                          1 Reply Last reply
                          0

                          11/13

                          13 Jul 2011, 21:29

                          • Login

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