linux c language programming environment to build

2010-10-09  来源:本站原创  分类:OS  人气:185 

inux c language programming environment to build

Need the following software and development kits:
terminal terminal
gcc / / compiler
cpp
libgcc
libc6 / / standard library math functions library directory in libc.so.6
binutils / / Connection Kit
/ Usr / bin / size
/ Usr / bin / ar
/ Usr / bin / objdump
/ Usr / bin / strings
/ Usr / bin / as
/ Usr / bin / ld
locals / / provide local support
libc6-dev / / c shared library header files
glibc-doc / / documentation
glibc-doc-reference / / reference manual
manpages-dev / / man function usage
make / / Maintenance Source Code
make-doc
gdb / / debugger
vim / / Editor
indent / / format the source code

Simple hello world code demonstrates the preparation of the implementation process:
Edit code with vi
root @ xuanfei-desktop: ~ / cpropram # vi hello.c
Formatting code with indent
root @ xuanfei-desktop: ~ / cpropram # indent-kr hello.c
View Code content
root @ xuanfei-desktop: ~ / cpropram # cat hello.c

# Include <stdio.h>
int main (int argc, char ** agv)
(
printf ("hello world \ n");
return 0;
)

View the original number of files under the directory
root @ xuanfei-desktop: ~ / cpropram # ls

hello.c txt

Compile hello.c file
root @ xuanfei-desktop: ~ / cpropram # gcc-Wall hello.c

Check again
root @ xuanfei-desktop: ~ / cpropram # ls

hello.c hello.c ~ a.out txt
Run the resulting compiled binary executable file
root @ xuanfei-desktop: ~ / cpropram #. / a.out

Results
hello world

int main (int argc, char * argv []) is lnux written under the standard c programming, argc is the number of parameters external command, argv [] store the contents of the parameters, see next argc argv following example demonstrates the use of a ,
View code:
root @ xuanfei-desktop: ~ / cpropram # cat 1.c
# Include <stdio.h>
int main (int argc, char ** argv)
(
printf ("hello \ n");
if (argc <2)
return -1;
else {
printf ("argc =% d argv [0] =% s argv [1] =% s \ n", argv, argv [0], argv [1]);
)
return 0;
)

Run:
root @ xuanfei-desktop: ~ / cpropram / 1 #. / a.out xuan fei

Results:
hello
argc = 3 argv [0] =. / a.out argv [1] = xuan

the value of argc is 3, representing the total number of parameters, namely: ". / a.out" "xuan" "fei"
argv [0] is ". / a.out"
argv [1] is "xuan"

Examples demonstrate II
View Code
root @ xuanfei-desktop: ~ / cpropram # cat argc.c
# Include <stdio.h>
int main (int argc, char ** argv)
(
int i;
for (i = 0; i <argc; i + +)
printf ("argv [% d] is% s \ n", i, argv [i]);
return 0;
)

Run:
root @ xuanfei-desktop: ~ / cpropram #. / a.out my name is xuanfei
Results:
argv [0] is. / a.out
argv [1] is my
argv [2] is name
argv [3] is is
argv [4] is xuanfei

This can clearly be seen on the contents of argv:)

Zhou made the above, according to linux video tutorial notes made, in order to enable easy understanding, suggest that you can go to the following link to download viewing.
Zhou made the video tutorial linux download (continuously updated from time to time transferred from: http://blog.chinaunix.net/u/29321/showart_344262.html

相关文章
  • linux c language programming environment to build 2010-10-09

    inux c language programming environment to build Need the following software and development kits: terminal terminal gcc / / compiler cpp libgcc libc6 / / standard library math functions library directory in libc.so.6 binutils / / Connection Kit / Us

  • Foreign language programming environment rankings (March 2010, TIOBE) 2010-04-12

    basic: All languages list . We see this in March 2010 TIOBE programming language list, from which you can see, the top three were, java, c and php. In the January rankings, Google Go language increased substantially, and was elected in 2009 Language

  • android programming environment to build 2011-01-09

    android is a good development environment to build, by default, you have already installed the JDK and eclipse, there must be a JDK, not to use the jre. 1. First, install the ADT plug-in, installed eclipse android to have the ability to develop, inst

  • 64-bit linux on the Notes environment to build Android 2011-09-17

    In Fedora 15 64bit operating system to build an Android Android development environment according to the smooth conduct of official guidance, including install the SDK, download the related components, such as installing ADT Plugin. However, entering

  • Linux programming environment described in Mod_perl 2011-06-04

    You are viewing Linux | Unix is ​​Linux programming environment described in the Mod_perl 1 Introductory Guide mod_perl is a huge and complex tool, it built a number of modules to help you easily build dynamic Web site. The purpose of this guide is t

  • Learning environment to build Linux Notes (continuously updated) 2010-09-05

    Learning environment to build Linux Notes (continuously updated) Today's "guidance" a friend to install Linux on some of the software, mainly JDK, Apache and Oracle, in fact not really guide, but she was just getting started with Linux. I can no

  • linux lighttpd + fcgi under the ROR environment to build 2010-12-07

    Off the home network, and only in the office to engage in a practice of this article, this article summarizes only one of his essays, robbin fcgi on lighttpd and built environment has been described in great detail, we proposed to the familiar, he is

  • Ruby on windows at the eclipse development environment to build 2009-04-18

    Learn a language, I think most should know is how to build such a language runtime environment. If the language of the operating environment we know, and then find the line with the past to develop the habit of IDE tools, and then take a look at the

  • Configuration of the Python programming environment based on VIM 2010-03-17

    1, configuration files in the directory / etc / or / etc / vim / Here, there is a document called the vimrc, which is the system common vim configuration files are valid for all users. In each user's home directory, can build their own private config

  • Qt programming environment under Windows configuration 2010-03-19

    Eclipse + CDT + MinGW: http://hexlee.javaeye.com/blog/499152 Windows + QT + Eclipse + MinGW tutorial build QT development environment more Keyword: c + + qt eclipse mingw Windows + QT + Eclipse + MinGW detailed tutorial build QT development environme

  • Taught you how to put Vim into an IDE programming environment converted 1 2010-10-01

    Taught you how to put Vim into an IDE programming environment modification (Photo) By: Wu Yin Date: 2007-09-07 Version: 0.5 Email: lazy.fox.wu # gmail.com Homepage: http://blog.csdn.net/wooin Copyright: Copyright of the article by Wu Yin and his love

  • [Android Xinshoubikan] Android development environment to build 2010-11-25

    [Android Xinshoubikan] Android development environment to build Android development environment to build, for a java developer, is very simple, but some of the android just getting started do not know how to build, Or help these little brothers, as l

  • Liferay 5.2.3 development environment to build 2010-05-02

    Liferay 5.2.3 development environment to build Prepared by: recky Version: 1.1 E-mail: [email protected] Date: 2010-03-04 1. About Liferay Liferay is a complete portal solution, based on J2EE applications, using technologies such as EJB and JMS, part o

  • S easy to understand introduction to Linux device driver programming 2010-08-19

    Currently, Linux software engineers can be broadly divided into two levels: (1) Linux Software Engineer (Application Software Engineer): mainly use C library functions and the Linux API to write applications; (2) Linux Firmware Engineer (Firmware Eng

  • Use Eclipse JEE + Mtj + Nokia S60 V3SDK J2ME application development environment to build 2010-10-14

    Use Eclipse JEE + Mtj + Nokia S60 V3SDK J2ME application development environment to build 2010-04-07 16:53 Under the Nokia S60 V3 J2ME application development, you need to build the official Nokia SDK provides environment. J2ME application developmen

  • linux c language usage of select function 2010-10-29

    Select the Socket programming is still relatively important, but for the beginner Socket love people who are not written with the Select program, they are only used to write, such as connect, accept, recv, or recvfrom block this process (the so-calle

  • Ubuntu Java development environment to build 2010-11-07

    Busy busy these days and windy project, the use of the weekend, you learn to Ubuntu System Java development environment to build it! I am using ubuntu-10.04-desktop-i386.iso, was established under the Window system installed on a virtual machine. The

  • websphere and weblogic cluster environment to build the next Session persistence 2010-12-17

    Recently familiar with websphere and weblogic cluster environment Session persistence, recording what note, no organized: Webphere Network deployment V6.1 Session persistence database mode set up a test environment: 1. To create a database session st

  • Android development of learning one. Development environment to build 2010-12-24

    First, the development environment to build 1.1 Introduction Baidu is a ******, Android under the know. Introduce a few terms: ADT (Android Development Tools, android development tools). DDMS debug monitor service. AVD (Android Virtual Devices, andro

  • Struts2 Spring2.5 hibernate3.3 the whole process of integrated development environment to build 2011-05-19

    Struts2 Spring2.5 hibernate3.3 the whole process of integrated development environment to build Recently, we developed the framework to be used s2sh B2C model e-commerce system, first we need to build the framework needed for the three major developm