Mac上配置C++ Eclipse 尤其是GDB错误

来源:互联网 发布:windows无法完成格式化 编辑:程序博客网 时间:2024/06/16 20:10

问题很多 Mac还是老老实实用xcode吧

安装Eclipse CDT

https://eclipse.org/cdt/

安装gdb

brew install gdb

安装完,debug时如果出现如下错误,请按照此文方法解决

"Launching projectName" has encountered a problem. Error with command gdb --version 

Error with command: gdb --versionCannot run program "gdb": Unknown reason

原文在此 https://www.ics.uci.edu/~pattis/common/handouts/macmingweclipse/allexperimental/mac-gdb-install.html

摘出精要部分于此

Creating a Certificate

Open the Keychain Access. Select Certificate Assistant
 -> Create a Certificate.



  1. Then click Continue to skip the next six screens until you see the one entitled Specify a Location For The Certificate
  2. Back in the main window, choose the System keychain in the sidebar on the left, and select the newly created certificate from the list. Open the context menu and select Get Info. In the information window that will appear, expand the Trust section and set the Code Signing property to Always Trust. Close this window (you may be asked for your password), and quit Keychain Access.

Signing GDB

You can use Activity Monitor to restart taskgated. Open it and filter the list of processes by typing taskgated in the search field in the toolbar. (If you cannot find it, make sure the menu item View
All Processes
 is checked.)

Terminate Taskgate process . In a few seconds, it will be restarted by the system and should reappear in the list. Please wait for this to happen (it may take up to a minute or two, at worst).

Finally, in a Terminal window, run codesign -s gdbcert /usr/local/bin/gdb (if you named your certificate differently, replace gdbcert with its name here). Once again, you will be prompted for you username and password. If the command does not produce any output, then GDB is successfully signed.

Configuring Eclipse

The only thing left to do is to point Eclipse to the GDB executable. Open Eclipse -> 
Preferences
 from the main menu . In the tree of options listed in the sidebar, navigate to C/C++
Debug
GDB
, and set the GDB debugger field to /usr/local/bin/gdb.



0 0
原创粉丝点击