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

由于安装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改为空即可。如下图所示

d6fdd9eef41a635b5b4c95dca3b2bdca.png

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和进行调试了

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/278953.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Redis学习笔记~分布式的Pub/Sub模式

redis的客户端有很多,这次用它的pub/sub发布与订阅我选择了StackExchange.Redis,发布与订阅大家应该很清楚了,首先一个订阅者,订阅一个服务,服务执行一些处理程序(可能是写个日志,插入个数据&am…

django自定义用户表

django自带了用户表。 -- auto-generated definition create table auth_user (id int auto_incrementprimary key,password varchar(128) not null,last_login datetime(6) null,is_superuser tinyint(1) not null,username varchar(150) not null,fir…

easyui关机图标_如何在Windows 10中创建关机图标

easyui关机图标It’s true that shutting down your Windows 10 PC the old-fashioned way only takes three clicks. But why spend the extra energy when you can do it in two? All you have to do is create a shutdown icon, and you’ll save yourself some time. 的确…

Struts2+JFreeChart

下面以边帖图片和代码的方式来讲解Struts2与JFreeChart的整合。搭建环境:首先帖一张工程的目录结构以及所需的jar包。注意:如果你不打算自己写ChartResult的话只需要引入struts2-jfreechart-plugin-2.0.6.jar(这个在struts-2.0.6-all.zip可以找到了): …

STM32的FLASH ID加密

#define FLASH_ID_OFFSET 30000 //任意定义一个数 //把地址直接减去或者加上一个数是不要程序中直接出现这个地址 volatile u32 Flash_ID_addr[3]{ 0x1FFFF7E8 - FLASH_ID_OFFSET, 0x1FFFF7EC FLASH_ID_OFFSET, 0x1FFFF7F0 - FLASH_ID_OFFSET }; /**读取STM32 FLASH ID*…

linux c视频如何加水印,如何在Kdenlive的视频上进行水印 | MOS86

如果你这些东西被称为水印。他们So,你如何在Linux中创建水印?嗯,你这可能是Linux上最强大的开源视频编辑器。Installation如果您尚未安装Kdenlive,您应该可以在包裹管理器中找到它。在Ubuntu中,您还可以使用命令:sudo …

mac触控板手势无法使用_如何在iPad上使用触控板手势

mac触控板手势无法使用Apple苹果Apple’s new floating Magic Keyboard case for the iPad Pro looks fantastic, but you don’t need to spend $299 to use a trackpad. Simply connect a Magic Trackpad or a third-party multi-touch trackpad to get access to all of iPa…

02.并发编程(2)Thread类源码分析

概述 在说线程之前先说下进程,进程和线程都是一个时间段的描述,是CPU工作时间段的描述。 进程,是并发执行的程序在执行过程中分配和管理资源的基本单位,是一个动态概念,竟争计算机系统资源的基本单位。每一个进程都有一…

安装SQLserver2008

双击点击setup,以管理员身份运行; 点击安装-》全新SQLServer独立安装或向现有安装添加功能 选择下一步,然后点击具有高级服务的express版本,点击下一步; 点击选择我接受许可条款,然后继续点击下一步&#x…

如何在没有Word的情况下打开Microsoft Word文档

Microsoft Word is part of Microsoft Office and requires an up-front purchase or a Microsoft 365 subscription. If you’re using a computer without Word installed, there are other ways to view that DOCX or DOC file. Microsoft Word是Microsoft Office的一部分&a…

redhat9Linux解压gz,linux (redhat9)下subversion 的安装

搞了一个subversion 花费了我两天的时间,其间虽然有干其他的事情,但是来来回回的装,搞的我是一点脾气都没有了,俗话说不经历风雨真的见不到彩虹。就是这个意思. 原本本的下来一.准备好安装包打算使用apache来浏览subversion &…

数组去重的4种方法(Which one is the fastest???嘻嘻嘻....)

<!DOCTYPE html> <html lang"en"> <head> <meta charset"UTF-8"> <title>Document</title> </head> <body> <input type"button" value"数组去重1" οnclick"show()"&g…

flask中的模型

1.什么是模型   模型&#xff0c;是根据数据库中表的结构而创建出来的class。每一张表对应到编程语言中&#xff0c;就是一个class表中的每一个列对应到编程语言中就class中的一个属性。 2.ORM的三大特征   1.数据表(table)到编程类(class)的映射     数据库中的每一张…

windows复制文件路径_如何在Windows 10上复制文件的完整路径

windows复制文件路径Sometimes, it’s handy to copy the full path of a file or folder in Windows 10 to the clipboard. That way, you can paste the path into an open or upload dialog quickly without having to browse for it the file. Luckily, there’s an easy w…

用c语言复制字符串的元音字母,急求:编写程序,将一个字符串中的元音字母复制到另一个字符串,然后输出。...

#include#includevoid str(char a[100],char b[100]){int i0, j0;while(a[i]!\0)//\0代表ASCLL码0的字符&#xff0c;即是一个空操作符也就是是结束符;{if(a[i]a||a[i]e||a[i]i||a[i]o||a[i]u){b[j]a[i];j;}i;}}int main(){char a[100];char b[100];gets(a);str(a,b);puts(b);r…

05 替换空格

题目描述&#xff1a; 请实现一个函数&#xff0c;将一个字符串中的每个空格替换成“%20”。例如&#xff0c;当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。 解题思路有&#xff1a; #判断字符串是否为空&#xff0c;判断length是否大于0。 #记录空格的数…

超链接禁用_在Microsoft Word 2003和2007中禁用自动超链接

超链接禁用If you can’t stand the automatic hyperlinking in Microsoft Word, you might be hard-pressed to find the right place to disable it in Office 2007, since all the settings are hidden so well compared to previous versions. 如果您无法在Microsoft Word中…

c语言如何创建虚拟串口,模拟串口的C语言源程序代码

本程序是模拟串口硬件机制写的&#xff0c;使用时可设一定时中断&#xff0c;时间间隔为1/4波特率&#xff0c;每中断一次调用一次接收函数&#xff0c; 每中断4次调用一次发送函数,不过.对单片机来说时钟并须要快.要知道9600的波特率的每个BIT的时间间隔是104us.而单片机中断一…

webjars管理静态资源

webjars用途简单解释 : 利用Servlet3协议规范中,包含在JAR文件/META-INF/resources/路径下的资源可以直接被web访问到这一原理&#xff0c;将前端静态资源打成jar包方便管理 静态资源打jar包 新建maven工程&#xff0c; 将需要打包的静态资源放入src/main/resources中 2. ma…

Windows Intellij环境下Gradle的 “Could not determine Java version from ‘9.0.1’”的解决方式...

当我导入Gradle项目初试Java spring的时候&#xff0c;遇到下面报错: Gradle complete project refresh failed Error:Could not determine java version from 9.0.1. 参考这篇 http://www.ddiinnxx.com/solving-not-determine-java-version-9-0-1-gradle-intellij-macosx/ 进行…