Debugging Qt app with Qt Creator: <no such value>
I'm using Qt Creator with Qt 5.1.1 in Ubuntu 12.04. When I'm using the debugger to show content of any variable, the window always show "no such value" on every variable. Also on variables of type QString
, int
etc. Is there a configuration problem on my Ubuntu? Can anybody help me please?
It's been a year and a half ago, but the problem still remains actual for Ubuntu 12.04, Qt Creator 3.4.0 based on Qt 5.4.1.
As mentioned in Qt Creator Manual
Starting with version 3.1, Qt Creator requires the Python scripting extension. GDB builds without Python scripting are not supported anymore and will not work. The minimal supported version is GDB 7.5 using Python version 2.7, or 3.3, or newer.
I suppose that gdb --version
gives you 7.4 (the last version of gdb for Ubuntu 12.04). That's why you have no such value issue.
1. Install a fresh gdb (7.8)
Remove the current gdb (to avoid conflicts with new one) and install development packet for python (to build gdb with Python scripting)
sudo apt-get remove gdb
sudo apt-get install python2.7-dev
Install gdb from the sources
wget http://ftp.gnu.org/gnu/gdb/gdb-7.8.tar.xz
tar -xf gdb-7.8.tar.xz
cd gdb-7.8/
./configure --prefix=/usr/local --with-python
make
sudo make install
Now gdb 7.8 is in /usr/local
.
2. Update Qt Creator settings
Tools
> Options ...
Build&Run
, tab Debuggers
Type Name you like, write Path: /usr/local/bin/gdb
In tab Kits
change Debugger: with that you just created
Hope this help someone who still love Ubuntu 12.04 and Qt.
链接地址: http://www.djcxy.com/p/17922.html