Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Call for Presentations - Qt World Summit

    Solved qDebug Initial setup Messed up?

    General and Desktop
    qdebug
    3
    10
    1787
    Loading More Posts
    • 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.
    • PascalJedi
      PascalJedi last edited by

      Just starting with QT, but something seems very off on my setup and wondering if others had a similar issue (Nothing showing up in google).

      Created a new test project; added "core" to the .pro file, wrote some code, but can't get past the first qDebug print. I moved the print all the way to the start of the application, but alas I always get a qDebug() SIGSEGV

      Thoughts on how I screwed this up?

      #include "mainwindow.h"
      #include <QApplication>
      #include <QDebug>

      int main(int argc, char *argv[])
      {
      qDebug() << "Hi"; // << This creates a SIGSEGV

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by mrjj

        Hi and welcome
        Can u mention Qt version and platform ?

        PascalJedi 1 Reply Last reply Reply Quote 0
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi and welcome to devnet,

          In order to initialize Qt's subsystems you should first create a Q*Application. Depending on your application it will be a QtCoreApplication, QGuiApplication or a QApplication.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            I missed one point: qDebug should work without any Q*Application created.

            Do you have any static QWidget object ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            PascalJedi 1 Reply Last reply Reply Quote 0
            • PascalJedi
              PascalJedi @mrjj last edited by

              @mrjj

              I am running stock Ubuntu 15.10


              Qt Creator 3.6.0
              Based on Qt 5.5.1 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit)

              Built on Dec 15 2015 01:01:12

              From revision b52c2f91f5

              Enterprise Features: Enabled
              Licensee: ****

              Copyright 2008-2015 The Qt Company Ltd. All rights reserved.

              The program is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

              1 Reply Last reply Reply Quote 0
              • PascalJedi
                PascalJedi @SGaist last edited by

                @SGaist

                Hi, and thank you both for taking the time to reply.

                I basically went File->New->QT Widgets Application

                I then went and did the button tutorial with a button and a label. Pressed button, worked fine. Then went and added a debug print inside that caller and it seg faulted. Scratched my head, google searched, moved the qDebug to the first line in main.

                I fully admit, this may be something super simple, but just don't know what setting I am missing.

                1 Reply Last reply Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  Since you're not doing anything special, I don't see any reason for such a segmentation fault to occur.

                  Can you run your application through the debugger ? That could provide some more information about what is happening.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  PascalJedi 1 Reply Last reply Reply Quote 0
                  • PascalJedi
                    PascalJedi @SGaist last edited by

                    @SGaist

                    Nothing special. I just did a command line application and qDebug works; I then went back and created a test another test widget application and it works there too.

                    I just deleted that first project and am starting to test out and play with the environment.

                    1 Reply Last reply Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      Looks like you had a gremlin in that project ;)

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      PascalJedi 1 Reply Last reply Reply Quote 1
                      • PascalJedi
                        PascalJedi @SGaist last edited by

                        @SGaist If there is one thing that is for sure; I can destroy any project while doing a "hello world" tutorial! Thanks for the eSupport.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post