QtCreator is a very good IDE that can be used to develop Qt applications and General C ++ applications. However, when you debug an application on Ubuntu, errors may occur (such as memory access errors). The QtCreator dialog box is displayed, showing QtCreator: ptraceoperationnotpermitted, as shown in. Solution: this error occurs especially in Versions later than Ubuntu11.04. There are two ways to solve this problem.
QtCreator is a very good IDE that can be used to develop Qt applications and General C ++ applications. However, when you debug an application on Ubuntu, errors may occur (such as memory access errors). The QtCreator dialog box is displayed, showing QtCreator: ptrace operation not permitted, as shown in.
Solution
This error especially occurs in Versions later than Ubuntu 11.04. To solve this problem, there are two methods, both of which require the root permission.
The first solution can temporarily solve this problem, but the next restart of the system will fail. Set the content of the/proc/sys/kernel/yama/ptrace_scope Virtual File to 0 and run the following command:
Sudo echo 0>/proc/sys/kernel/yama/ptrace_scope
The second solution can solve this problem permanently by editing the/etc/sysctl. d/10-ptrace.conf file and setting
Kernel. yama. ptrace_scope = 0 (1 by default)
This will also take effect at the next startup.
Cause
In Versions later than Ubuntu 11.04 ("Natty Narwhal"), a security mechanism called ptrace scope is introduced. This mechanism prevents users from accessing the memory and status of the currently running process, which causes the debugger of QtCreator to not work properly. This security mechanism can prevent malicious software from attaching to other processes (such as SSH or GPG), read program memory, and cause security problems.
------------------------------------------ Split line ------------------------------------------
Another example:
Click the icon to run the qt creator. An error is reported during debugging,
Obviously, the permission is insufficient. The solution is to use sudo./qtcreator instead.
You can create
Shortcut, so you do not need to cd to the directory where the program is located every time.