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. Without debugging code is not executed ?!?
Forum Updated to NodeBB v4.3 + New Features

Without debugging code is not executed ?!?

Scheduled Pinned Locked Moved General and Desktop
10 Posts 6 Posters 5.5k 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.
  • P Offline
    P Offline
    przemo_li
    wrote on last edited by
    #1

    Hi
    I'm playing with QtOpenGL examples. I've changed Hello world example to:

    @GLWidget::GLWidget(QWidget *parent)
    : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
    {
    format().setProfile(QGLFormat::CoreProfile);
    format().setVersion(4,0);
    cout << format().profile()<<endl;
    cout << "HIIIIIII!!!!!!!!!!!!!" << endl;@

    Now when I set trap before format().set.... it execute also couts (sic!) before it stops.
    And if I do not set trap whole code is not executed at all. (strings are not send to cout).

    What is wrong?

    PS How to set version of OGL in constructor of QGLWidget? Above code do not work (format().profile() return 0 -> no OGL3+)

    Win7, ati hd 5720 with catalyst 10.9, OGL 4.0 working

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on last edited by
      #2

      I think, your app is not a console app, right? If it is not, cout will not be send to commandline (not on windows, don't know exactly on Linux).
      I'm pretty sure, your code is executed.

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dangelog
        wrote on last edited by
        #3

        [quote author="przemo_li" date="1292506244"]Hi
        I'm playing with QtOpenGL examples. I've changed Hello world example to:

        @GLWidget::GLWidget(QWidget *parent)
        : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
        {
        format().setProfile(QGLFormat::CoreProfile);
        format().setVersion(4,0);
        cout << format().profile()<<endl;
        cout << "HIIIIIII!!!!!!!!!!!!!" << endl;@

        Now when I set trap before format().set.... it execute also couts (sic!) before it stops.
        And if I do not set trap whole code is not executed at all. (strings are not send to cout).

        What is wrong?

        PS How to set version of OGL in constructor of QGLWidget? Above code do not work (format().profile() return 0 -> no OGL3+)

        Win7, ati hd 5720 with catalyst 10.9, OGL 4.0 working[/quote]

        Under windows
        @
        CONFIG += console
        @
        in your .pro file to link against console libraries. Moreover, I don't get what you're trying to do there: format() returns the current format by value, it's pointless to call setters on it.

        Software Engineer
        KDAB (UK) Ltd., a KDAB Group company

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on last edited by
          #4

          [quote author="Gerolf Reinwardt" date="1292506462"]I think, your app is not a console app, right? If it is not, cout will not be send to commandline (not on windows, don't know exactly on Linux).[/quote]On Linux the text will be sent to stdout. Whether it's shown or not depends on whether the program is started from console or not.

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • S Offline
            S Offline
            stukdev
            wrote on last edited by
            #5

            Yes, but also in windows without use a console.
            If you run a gui in qtcreator and in the code write some printf() function in output of qtcreator you see the printf() output.

            [quote author="Franzk" date="1292532802"]
            [quote author="Gerolf Reinwardt" date="1292506462"]I think, your app is not a console app, right? If it is not, cout will not be send to commandline (not on windows, don't know exactly on Linux).[/quote]On Linux the text will be sent to stdout. Whether it's shown or not depends on whether the program is started from console or not.
            [/quote]

            1 Reply Last reply
            0
            • F Offline
              F Offline
              Franzk
              wrote on last edited by
              #6

              [quote]format() returns the current format by value, it's pointless to call setters on it.[/quote]

              That means you have to
              @GLWidget::GLWidget(QWidget *parent)
              : QGLWidget(QGLFormat(QGL::SampleBuffers), parent)
              {
              QGLFormat f = format();
              f.setProfile(QGLFormat::CoreProfile);
              f.setVersion(4,0);
              setFormat(f);
              ...
              }@

              "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #7

                bq. Stuk wrote:
                Yes, but also in windows without use a console.
                If you run a gui in qtcreator and in the code write some printf() function in output of qtcreator you see the printf() output.

                QtCreator connects to stdout of the process. That is always possible if you start processes,a slo with QProcess. But on a windows console, if you start non console apps, the console does not connect to the stdout as it just creates the process and gets back to the console.

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  przemo_li
                  wrote on last edited by
                  #8

                  @QGLFormat f = format();
                  f.setProfile(QGLFormat::CoreProfile);
                  f.setVersion(4,0);
                  setFormat(f);@

                  Works :)

                  cout do not :( (only when debugging)

                  @CONFIG+= console@
                  Make no effect.

                  Anyway I'll try Qt way to log errors. And now I know how to set OGL properly.
                  Thx to all.

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    goetz
                    wrote on last edited by
                    #9

                    QtOpenGl depends on QtGui libs. The console option strips the latter out.

                    http://www.catb.org/~esr/faqs/smart-questions.html

                    1 Reply Last reply
                    0
                    • F Offline
                      F Offline
                      Franzk
                      wrote on last edited by
                      #10

                      [quote author="Volker" date="1292586765"]QtOpenGl depends on QtGui libs. The console option strips the latter out.[/quote]Probably fixable by doing @QT += gui@ then.

                      "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

                      http://www.catb.org/~esr/faqs/smart-questions.html

                      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