由于安装Eclipse需要Java环境,还需要配置环境,非常复杂,建议安装系统时,选择上Eclipse开发工具

但是安装的Eclipse中没有CDT。首先给Eclipse安装一个CDT。

1.安装CDT

Eclipse菜单栏help----Install New Software.从Available Software Sites中选择

http://download.eclipse.org/tools/cdt/releases/helios的网址,然后select all。

我将所有选项都选择了。

一步步往下走,最后重启Eclipse即可。

2.Linux下修改Eclipse的默认语言。

安装CDT后,Eclipse的默认语言为汉语,实在不习惯啊。我打算将其修改为英文。修改方式如下:

1)通过whereis eclipse找到eclipse的位置。

$whereis eclipse

output:

/usr/bin/eclipse /etc/eclipse.ini /usr/lib/eclipse /usr/share/eclipse

2)打开eclipse.ini修改其中内容

$vim  /etc/eclipse.ini

output:

添加一句话

-Duser.language=en

保存退出

3)重新启动Eclipse,成功变为英文界面。

3.编写第一个C/C++Project

1)新建项目 File--New---C Project

选择Executable-----Empty Project ----Linux GCC

假设我的项目名为HelloWorld

2)新建源文件

左侧Project Explorer 中,选中HelloWorld点击右键 New---Source File

切记:命名时要加上后缀.c,不然会提示错误。

3)输入源代码

#include main() { printf("Hello world!\n"); }

切记:1)一定要保存,否则会提示错误。

2)如果是新建C++Project,后缀名为.cpp

4.导入已经存在的项目

1)概述:

在安装CDT后,出现的C/C++ Project为 C Project 、C++ Project、 Makefile C Project。但是很多教程中都包括的是Standard Make C++ Project。瞬间让我失望。终于还是找到了最可爱的官方文档。 http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_c_build_over.htm

步骤1:必须创建一个简单的项目,该项目能够反映已存在源代码树中的所有元素

1.选择File > New > Project.

2.对于该项目,选择C/C++和C project。由于后文中要导入Nginx(完全由C编写),因此选择C Project。

3.在Project Name中,输入项目名

4.确保Use default location 没有被选中。因为我们要指定源代码所在的位置,而不是我们的工作区,因此,不能使用use default location.

5.在Location处,点击Browse,选择源代码和Makefile所在的文件夹。假设源代码和Makefile所在的文件夹为Nginx-1.2.3。

6.从Project types列表中,展开Makefile Project,选择Empty Project。

7.确保选择上Toolchains。Toolchains选择Linux GCC。

8.点击Next

9.(可选)全选,点击Next即可。

10.点击Finish,关闭对话框。

完成上述步骤后,在Project Explorer view中就可以看到新的项目。

5.导入Nginx所需要做的工作

对于Nginx的源代码,在完成上述步骤以后,会发现在console中会提示以下错误,该如何解决呢?

make all

make:*** 没有规则可以创建目标“all”。停止

或者

make: *** no rule to make target 'all'.

1)修改build选项。主要是修改Build的取值。

在我的Eclipse版本中,修改方法如下:

1.在Project Explorer中选中Nginx-1.2.3项目,点击右键选中Project Properties。在右侧找到C/C++ Build。

2.C/C++ Build ----Behavior 将Build改为空即可。如下图所示

3.配置运行参数,打开Run Configuration对话框

1)在菜单栏Run---Run Configuration 中设置。C/C++ Application中选择objs/nginx(如果没有,先make一次)。Arguments添加

-c /home/hpnl/nginx_source/nginx-1.2.3/conf/nginx.conf指定运行时配置文件。注意:所添加的conf文件是在nginx源代码目录中的。

2)修改该conf的内容(完整文件)加粗字体为改动部分。

#user  nobody;

worker_processes  1;

daemon  off;

#daemon must be set as off

#error_log  logs/error.log;

#error_log  logs/error.log  notice;

#error_log  logs/error.log  info;

events {

worker_connections  1024;

}

http {

include       mime.types;

default_type  application/octet-stream;

#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

#                  '$status $body_bytes_sent "$http_referer" '

#                  '"$http_user_agent" "$http_x_forwarded_for"';

#access_log  logs/access.log  main;

sendfile        on;

#tcp_nopush     on;

#keepalive_timeout  0;

keepalive_timeout  65;

#gzip  on;

server {

listen       80;

server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location / {

root   html;

index  index.html index.htm;

}

location /hello{

hello_world;

}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html

#

error_page   500 502 503 504  /50x.html;

location = /50x.html {

root   html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

#    proxy_pass   http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

#location ~ \.php$ {

#    root           html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

#    deny  all;

#}

}

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

#    listen       8000;

#    listen       somename:8080;

#    server_name  somename  alias  another.alias;

#    location / {

#        root   html;

#        index  index.html index.htm;

#    }

#}

# HTTPS server

#

#server {

#    listen       443;

#    server_name  localhost;

#    ssl                  on;

#    ssl_certificate      cert.pem;

#    ssl_certificate_key  cert.key;

#    ssl_session_timeout  5m;

#    ssl_protocols  SSLv2 SSLv3 TLSv1;

#    ssl_ciphers  HIGH:!aNULL:!MD5;

#    ssl_prefer_server_ciphers   on;

#    location / {

#        root   html;

#        index  index.html index.htm;

#    }

#}

}

此时就可以正常运行Nginx和进行调试了

linux 下eclipse调试程序,文章2 Linux安装Eclipse阅读及调试程序相关推荐

  1. Linux下Centos7以rpm方式离线安装MySQL5.7教程以及部分报错解决方案

    Linux下Centos7以rpm方式离线安装MySQL5.7教程以及部分报错解决方案 参考文章: (1)Linux下Centos7以rpm方式离线安装MySQL5.7教程以及部分报错解决方案 (2) ...

  2. mysql5.6.24安装perl,linux下perl操作MySQL数据库(需要安装DBI)

    这篇文章主要为大家详细介绍了linux下perl操作MySQL数据库(需要安装DBI),具有一定的参考价值,可以用来参考一下. 感兴趣的小伙伴,下面一起跟随512笔记的小编小韵来看看吧!DBI安装:D ...

  3. linux设置软件的路径,linux下查看和设置软件的安装路径

    1:你可以通过whereis 软件名来查找系统里的文件位置 比如你想查找eclipse文件,那么就: [root@localhost ~]# whereis eclipse 会显示: eclipse: ...

  4. Linux下开源打包工具fpm的安装与使用(超详细)

    Linux下开源打包工具fpm的安装与使用 一.fpm概述 二.fpm的安装 1.安装ruby环境 2.安装fpm 三.fpm的使用 1.fpm常用参数 2.举例要求 3.准备目录 4.编写脚本文件 ...

  5. Linux下boost库的编译、安装详解

    1.下载源文件 去官网下载:http://www.boost.org/ 这里下载最新版本 wget https://dl.bintray.com/boostorg/release/1.64.0/sou ...

  6. linux显卡驱动mxm,linux下我的FX5200显卡驱动安装

    linux下我的FX5200显卡驱动安装 发布时间:2008-09-20 16:42:33来源:红联作者:Keiboc 一.为什么要装驱动 一般情况下,只要你下载了LINUX的最新发行版本,比如Fed ...

  7. VMware Linux下拖拽补丁vmtools的安装和卸载

    Linux下拖拽补丁vmtools的安装和卸载 by:授客 QQ:1033553122 Vmware 8.0.4为例子 步骤1.VM->Install Vmware Tools... 步骤2.查 ...

  8. apache安装_kali Linux下的Apache的配置和安装:

    kali Linux下的Apache的配置和安装: 首先,我要说的是,今天浪费了太多的时间在yum的安装上面,一直出现bash:yum命令不可用.去找了教程需要rpm下载一些包,于是又出现bash:r ...

  9. linux星际译王安装,Linux下星际译王 stardict 的安装

    Linux下星际译王 stardict 的安装 (2006-03-07 11:05:28) "星际译王"是用Gtk2开发的跨平台的国际化的词典软件.它具有"通配符匹配&q ...

  10. sai linux下载地址,Linux下beego及beego相关插件安装

    Linux下beego及beego相关插件安装 1.下载及配置go环境看见链接: 这里下载的包名是: go1.12.5.windows-amd64.zip 解压以上包: 可以自行解压指定位置,/usr ...

最新文章

  1. Python Qt GUI设计:QCalendar日历类和QDateTimeEdit时间类(基础篇—20)
  2. 不同项目配置不同的 Git 账号
  3. MusicXML 3.0 (4) - 谱号
  4. Linux下mysql整库备份
  5. python学习随笔day3
  6. 从中师到博士,我的22年...
  7. python3-pandas 缺失数据的处理
  8. 【Servlet】Servlet体系结构
  9. Swift - 使用NSURLSession同步获取数据(通过添加信号量)
  10. java 数据源调用_实战分享: Spring boot 调用之间实现动态数据源
  11. 台式电脑连接蓝牙耳机_怎样知道电脑(台式机)有没有蓝牙?
  12. oracle备份恢复演练,记一次生产库的impdp恢复演练
  13. Spring Framework 官方文档学习(四)之Validation、Data Binding、Type Conversion(二)
  14. python贪吃蛇源码下载_Python贪吃蛇源代码
  15. 设计一个雇员Employee类
  16. 【集训队作业】LYRC
  17. 惊艳呈现-百度搜索手机客户端-设计项目分享
  18. 关于pc浏览器浏览外网出现ERR_EMPTY_RESPONSE的问题
  19. 【Java EE】从零开始写项目【总结】
  20. ZGF建筑事务所公布波特兰国际机场新航站楼设计方案,木构屋顶展现自然景观

热门文章

  1. phpstudy页面不存在_网站的404页面对于SEO的重要作用
  2. mysql 取 映射数据库中_JAVA与数据库MySQL相连接
  3. 计算机网络实验11.6.1,6.111 2004春季课程:数位系统概论实验(Introductory Digital Systems Laboratory, Spring 2004)...
  4. linux ftp 工作过程,linux中ftp的安装过程记录[运维篇]
  5. 初识docker,弄清镜像和容器
  6. 自定义ProgressBar(圆)
  7. RDS for MySQL Mysqldump常见问题及处理
  8. 关于 MySQL 的 boolean 和 tinyint(1)
  9. Linux之tomcat日志管理
  10. 安卓 Input Events(输入事件)