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. qDebug Initial setup Messed up?
QtWS25 Last Chance

qDebug Initial setup Messed up?

Scheduled Pinned Locked Moved Solved General and Desktop
qdebug
10 Posts 3 Posters 2.4k Views
  • 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
    PascalJedi
    wrote on 22 Feb 2016, 19:44 last edited by
    #1

    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
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 22 Feb 2016, 20:18 last edited by mrjj
      #2

      Hi and welcome
      Can u mention Qt version and platform ?

      P 1 Reply Last reply 22 Feb 2016, 20:56
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 22 Feb 2016, 20:27 last edited by
        #3

        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
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 22 Feb 2016, 20:40 last edited by
          #4

          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

          P 1 Reply Last reply 22 Feb 2016, 21:02
          0
          • M mrjj
            22 Feb 2016, 20:18

            Hi and welcome
            Can u mention Qt version and platform ?

            P Offline
            P Offline
            PascalJedi
            wrote on 22 Feb 2016, 20:56 last edited by
            #5

            @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
            0
            • S SGaist
              22 Feb 2016, 20:40

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

              Do you have any static QWidget object ?

              P Offline
              P Offline
              PascalJedi
              wrote on 22 Feb 2016, 21:02 last edited by
              #6

              @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
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 22 Feb 2016, 21:20 last edited by
                #7

                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

                P 1 Reply Last reply 22 Feb 2016, 21:27
                0
                • S SGaist
                  22 Feb 2016, 21:20

                  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.

                  P Offline
                  P Offline
                  PascalJedi
                  wrote on 22 Feb 2016, 21:27 last edited by
                  #8

                  @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
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 22 Feb 2016, 21:31 last edited by
                    #9

                    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

                    P 1 Reply Last reply 22 Feb 2016, 21:34
                    1
                    • S SGaist
                      22 Feb 2016, 21:31

                      Looks like you had a gremlin in that project ;)

                      P Offline
                      P Offline
                      PascalJedi
                      wrote on 22 Feb 2016, 21:34 last edited by
                      #10

                      @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
                      0

                      10/10

                      22 Feb 2016, 21:34

                      • Login

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