以root身份在Qt-Creator SDK上运行代码 [英] running the code as root on Qt-Creator SDK

查看:85
本文介绍了以root身份在Qt-Creator SDK上运行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Qt-Creator 2.5.2 SDK在Linux上开发C代码.从SDK界面(例如ctrl + R)运行时,如何以root身份运行代码?

I use Qt-Creator 2.5.2 SDK to develop C code on Linux. How is it possible to run the codes as root when it is run from the SDK interface (e.g., ctrl + R)?

推荐答案

最简单的以root用户身份运行Qt-Creator的解决方案

Most simple solution to run Qt-Creator as root

老实说,那不是一件微不足道的任务(只要我之前尝试自己做过). 您确定您确实需要在root用户下运行debug吗?如果是关于访问某些设备节点的信息,是否可能更容易调整它们的权限?

Honestly thats not a trivial task (as long as I tried to do it myself while ago). Are you sure you really need to run debug under root? If it's about access to some device nodes, may be it's easier to adjust rights on them?

另一种解决方案(让QT创建者在用户帐户下运行可以类似)

Another solution (keeping QT creator running under user account can be something like)

调整sudoers(/etc/sudoers)

adjust sudoers (/etc/sudoers)

 <user> <machine>= NOPASSWD: /usr/bin/gdb

然后制作一个包装脚本,如/usr/bin/sudo-gdb:

then make a wrapper script something like /usr/bin/sudo-gdb:

 #!/bin/bash
 sudo gdb $@

然后指示QT Creator使用sudo-gdb作为调试器.

Then instruct QT Creator use sudo-gdb as debugger.

这篇关于以root身份在Qt-Creator SDK上运行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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