使用QtCreator设置GDB [英] Setup GDB with QtCreator

查看:3950
本文介绍了使用QtCreator设置GDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的项目使用OpenCV和cmake,并有两个源文件只有segmentation.h和segmentation.cpp。

I have a simple project using OpenCV and cmake, and has two source files only segmentation.h and segmentation.cpp.

这里是cmakefile:

Here is the cmakefile:

project(Segment)
cmake_minimum_required(VERSION 2.8)

SET(CMAKE_BUILD_TYPE Debug)
SET(CMAKE_VERBOSE_MAKEFILE true)

if(CMAKE_COMPILER_IS_GNUCXX)
    message(STATUS "GCC detected, adding compile flags")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -std=c++98 -Wall")
endif(CMAKE_COMPILER_IS_GNUCXX)

find_package(OpenCV REQUIRED)
add_executable(Lulu segmentation.cpp segmentation.h)
target_link_libraries(Lulu ${OpenCV_LIBS})



我创建了一个带有参数发送到cmake的调试版本:-DCMAKE_BUILD_TYPE =调试。但是QtCreator仍然跳过断点,不能正确启动gdb:

I created a Debug build with argument sent to cmake: -DCMAKE_BUILD_TYPE=Debug . However QtCreator still skip the break points, and can't start gdb properly:

&"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n"

如何解决此问题?

推荐答案

转到项目运行,在运行设置中选中在终端中运行。它会使QT Creator在一个XTerm(默认)中启动程序,并与gdb一起工作,并产生&警告:GDB:无法设置控制终端:不适当的ioctl设备\\\
问题消失。

Go to Project, Run and in the run settings check the box that say Run in Terminal. It will make QT Creator launch the program inside a XTerm (default) that plays well with gdb and makes the &"warning: GDB: Failed to set controlling terminal: Inappropriate ioctl for device\n" problem go away.

默认情况下,启动调试器时,它也会带来QT Creator到前台,从而隐藏被启动的终端。要停止此行为,请转到工具选项调试器。在常规标签中,取消选中应用程序中断时将Qt Creator设置为前台复选框。

By default, when launching the debugger, it will also bring QT Creator to the foreground and thus hide the terminal that was brought up. To stop this behaviour go to: Tools, Options, Debugger. In the General tab, untick the check box that say Bring Qt Creator to foreground when application interrupts.

您要更改终端,可以在选项环境中进行更改。在系统部分终端中输入您想要的内容。对于原生Ubuntu / Gnome终端,请将其设置为 / usr / bin / gnome-terminal -x 。此设置中的参数必须告知终端执行外部命令或程序。

If you want to change the terminal, you can do so in Options, Environment. In the System section the Terminal to what you want. For native Ubuntu / Gnome terminal, set it to /usr/bin/gnome-terminal -x. The parameters in this setting must tell the terminal to execute an external command or program.

这篇关于使用QtCreator设置GDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆