mac下搭建eclipse java/c++开发环境及gdb安装

来源:互联网 发布:网络餐饮新规 编辑:程序博客网 时间:2024/05/21 19:44

1、下载 Eclipse( Java 和 C/C++两个版本)http://www.eclipse.org/downloads/


2、解压缩刚下载下来的两个版本Eclipse,注意不要覆盖了文件名相同的文件,然后将C/C++ 版本的Eclipse 里面的plugins 文件夹中的内容全部复制,粘贴到Java 版本的Eclipse 里面的plugins 文件夹下面


3、创建java和c++工程,Build Project 后运行。
     可能错误:1)运行java程序,eclipse:selection cannot be launched,and there are no recent launches
                          run—>run configuration—>eclipse application—>new ~  新建一个eclipse configuration
                     2)运行c++程序,Launch failed. Binary not found.
                             build all
                             run—>run as location c++ application
                             

4 安装GDB,目前程序可以运行但是无法调试。在Xcode的command line tools里面已经没有gdb,要单独安装。


一:安装brew

terminal 输入命令

 curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1


二:使用brew安装GDB    
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb  

三:制作证书
过程参考 http://plotcup.com/a/129 

四:配置eclipse,进行debug。

Preferences > C/C++ > Debug > GDB


http://ntraft.com/wp-content/uploads/2014/01/eclipse-gdb-pref1.png


如果你已经创建了一些工程,比如上面的测试程序,可以在Run > Debug Configurations进行修改。


eclipse-gdb-debug



完~


参考链接:
1、http://www.cnblogs.com/pandy/archive/2013/02/27/2935320.html
2、http://blog.csdn.net/chenyi8888/article/details/7345113
3、http://logic0.blog.163.com/blog/static/1889281462014183271283/
4、http://www.cnblogs.com/yinxiangpei/articles/3897701.html
0 0
原创粉丝点击