qDebug Initial setup Messed up?
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?
int main(int argc, char *argv)
qDebug() << "Hi"; // << This creates a SIGSEGV
Hi and welcome
Can u mention Qt version and platform ?
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.
I missed one point: qDebug should work without any Q*Application created.
Do you have any static QWidget object ?
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
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.
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.
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.
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.
Looks like you had a gremlin in that project ;)
@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.