Article 2 install the eclipse reading and debugging program in Linux

Source: Internet
Author: User
Why should we use eclipse in order 0?

1. Install CDT
2. Modify the default eclipse language in Linux.
3. Write the first C/C ++ projec
T4. import an existing project
5. What To Do To import nginx
6. Notes


0 Why use eclipse?Because Visual Studio and other IDE development environments cannot be used in Linux, if you use VI and other editors to debug large code, it is really effort-consuming (of course it doesn't matter to Daniel ). In addition, programmers know that source insight can be used in Windows to easily read the code, but it cannot run in Linux. Is there a good IDE environment that can be run in Linux? Of course, it is eclipse + CDT. Eclipse can be described as a combination of source insight and Visual Studio, that is, eclipse can both easily read the code and debug.

I have adopted the centos 6.2 system. When installing the system, I have selected eclipse for installation.

The installation of eclipse requires a Java environment and a configuration environment, which is very complex. When installing the system, we recommend that you use the eclipse development tool.

However, the installed eclipse does not contain CDT. First install a CDT for eclipse. 1. Install CDTEclipse menu bar help ---- install new software. Select http://download.eclipse.org/tools/cdt/releases/heliosfrom available software sites, then select
All. I have selected all the options. Step by step, and then restart eclipse. 2. Modify the default eclipse language in Linux.After CDT is installed, eclipse uses the Chinese language by default. I plan to change it to English. The modification method is as follows: 1) Find the eclipse location through whereis eclipse.
$ Whereis eclipse
Output:
/Usr/bin/Eclipse/etc/eclipse. INI/usr/lib/Eclipse/usr/share/eclipse
2) Open eclipse. ini to modify the content.
$ Vim/etc/eclipse. ini
Output:
Add a sentence
-Duser. language = EN
Save and exit
3) Restart eclipse. The English interface is successfully displayed. 3. Write the first C/C ++ Project1) create a project file -- New --- C Project select executable ----- empty project ---- Linux GCC suppose my project name is helloworld 2) create a source file in the left-side project explorer, right-click helloworld and right-click New --- source file. Remember to add a suffix to the name. c. Otherwise, an error is prompted. 3) Input Source Code
# Include <stdio. h>
Main (){
Printf ("Hello world! \ N ");
}
Remember: 1) Be sure to save it; otherwise, an error will be prompted. 2) If you are creating a C ++ project, the suffix is. cpp. 4. Import an existing project1) Overview: After CDT is installed, the C/C ++ project that appears is C Project, C ++ project, and makefile C Project. However, many tutorials include standard make C ++ project. I was instantly disappointed. Finally, I found the most lovely official document. Http://help.eclipse.org/indigo/index.jsp? Topicture2forg.eclipse.cdt.doc.user%2fconcepts%2fcdt_c_build_over.htm Step 1: You must create a simple project that reflects all elements in the existing source code tree. select File> New> project. 2. for this project, select C/C ++ and C Project. Since nginx needs to be imported later (written entirely by C), select C Project. 3. In project name, enter the project name 4. Make sure that the use default location is not selected. Because we need to specify the location where the source code is located, rather than our workspace, we cannot use default location. 5. Click Browse at location to select the folder where the source code and makefile are located. Assume that the source code and makefile are in the Nginx-1.2.3 folder. 6. From the project types list, expand makefile project and select empty project. 7. Make sure you select toolchains. Select Linux GCC for toolchains. 8. Click Next 9. (Optional) Select All and click Next. 10. Click Finish to close the dialog box. After completing the preceding steps, you can view the new project in the project explorer view. 5. What should I do to import nginx? After completing the above steps for nginx source code, the following error will be displayed on the console. How can this problem be solved?
Make all
Make: *** the target "all" can be created without rules ". Stop
Or
Make: *** no rule to make target 'all '.

1) modify the build option. It mainly modifies the value of build. In my eclipse version, modify the method as follows: 1. Select the Nginx-1.2.3 project in project explorer, right-click to select project properties. Find C/C ++ build on the right. 2. C/C ++ build ---- Change build to empty. 3. Configure the running parameters. Open the run configuration dialog box. 1) set the parameters in run --- run configuration on the menu bar. In C/C ++ application, select objs/nginx (if not, make it once first ). Add arguments -C/home/hpnl/nginx_source/nginx-1.2.3/CONF/nginx. confSpecifies the runtime configuration file. Note: The added conf file is in the nginx source code directory. 2) modify the content of the conf file (complete file) in bold to the modified part.
# 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 x.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 Fig: 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 5 m;

# Ssl_protocols SSLv2 SSLv3 tlsv1;
# Ssl_ciphers high :! Anull :! MD5;
# Ssl_prefer_server_ciphers on;

# Location /{
# Root HTML;
# Index index.html index.htm;
#}
#}

}

Now you can run nginx and debug it properly.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.