PDA

View Full Version : Have qmake add the C debugging option (-g)



kiss-o-matic
14th January 2010, 01:54
Got a head scratcher. I want my program compiled w/ the -g debugging flag to valgrind won't be so damn cryptic. Can't figure it out though... any help?

faldzip
14th January 2010, 07:38
Run QtAssistant, on Index tab type "qmake" and then click twice on "qmake Variable Reference" and look for a variable suitable for you, but anyway, I think that qmake adds -g in debug on Linux but I'm not sure.

kiss-o-matic
14th January 2010, 09:00
Apparently my QtAssistant as fubar as it's looking /usr/doc/qt/3. I can see the reference here (http://doc.trolltech.com/4.1/qmake-variable-reference.html) which I assume is the same. I messed around with QMAKE_CXXFLAGS_DEBUG but got nothing so far.

wysota
14th January 2010, 09:37
-g should be added automatically by qmake for both debug and release builds, as far as I remember. But valgrind tends to be criptic regardless of the -g flag. Maybe you should change the params you run valgrind with? And think about adding a "-ggdb" option instead of pure "-g".

vcp
14th January 2010, 18:03
Hi,

For pass parameters for the gcc you should use some special variables for this, as QMAKE_CXXFLAGS.
Access in your QtAssistance this URL qthelp://com.trolltech.qmake.453/qdoc/qmake-manual.html. (if you are using this version)
or type qmake inside 'Search for' field and select QMake Manual

Add this variables inside you .pro file like this:

unix : QMAKE_CXXFLAGS = -g

if you are using Window$ native ou *unix native plataform the prefix unix: ou win32: isn't necessary.

kiss-o-matic
26th January 2010, 06:09
Hey Guys: Sorry for the late reply.

>> vcp

That's the one -- I've got the -g in in there now. Thanks a mil.

>>wysota

Indeed, it is, but w/ -g it should give me more info. Line numbers, specifically, which is crucial for large projects.

Thanks again.