ºìÁªLinuxÃÅ»§
Linux°ïÖú

Linux Ï C ±à³Ì´ÓÁ㿪ʼ

·¢²¼Ê±¼ä:2005-05-10 00:11:21À´Ô´:ºìÁª×÷Õß:thej
ÕâÀïÏò´ó¼Ò½éÉÜÒ»ÏÂÔÚLinux/UNIX µÄ»úÆ÷ÉÏ£¬½øÐÐ C/C++ ±à³ÌµÄһЩÈëÃż¶ÖªÊ¶¡£

? ËùÐè¾ß±¸µÄ±³¾°ÖªÊ¶
? ¿ª·¢ËùÐèµÄ»ù±¾»·¾³
? »ñµÃ°ïÖúµÄ;¾¶
? ͨ¹ýÒ»¸öʵÀýÁ˽â»ù±¾²½Öè


Prerequisite ÏȾöÌõ¼þ£º
ÔÚLinuxÉϱàд C ³ÌÐò£¬ÖÁÉÙÒªÊìϤÒÔÏÂÁ½·½ÃæµÄ»ù´¡ÖªÊ¶£º

1£® CÓïÑԵıà³Ì»ù´¡£¬ÖÁÉÙÒªÖªµÀһЩ»ù±¾µÄÓï·¨£¬¿ØÖÆÁ÷³ÌµÈ±à³Ì³£Ê¶¡£
¶Ô³£Óõıê×¼ C º¯Êý¿âÓг£Ê¶ÐÔµÄÁ˽⡣

2£® ¶ÔLinux/UNIX µÄ²Ù×÷Óг£Ê¶ÐÔµÄÁ˽⣬ÕÆÎÕ³£ÓõÄshell ÃüÁÈç ls, cat, cp, mkdir ¡­etc.


Environment ËùÐè»·¾³:

1£® Linux/ Unix µÄ²Ù×÷ϵͳ£¬Ò²¿ÉÒÔʹÓÃwindowsϵÄcygwin¡£

ÎÒÃÇÕâÀïÌÖÂ۵Ķ¼ÊÇͨ¹ýshellÃüÁîÐнøÐвÙ×÷µÄ¡£ÄÇÈç¹û½øÈëÁËͼÐνçÃæµÄLinux Ôõô°ìÄØ£¿Ö»Òª´ò¿ªÒ»¸öÖÕ¶ËÃüÁ¾ÍºÍÃüÁîÐл·¾³ÍêÈ«Ò»ÑùÁË£¨´ò¿ª¿ªÊ¼²Ëµ¥¿ÉÒÔÕÒµ½ÖÕ¶ËÃüÁ¡£

2£® ±Ø±¸µÄ¿ª·¢¹¤¾ß£º

1) ÊäÈë³ÌÐòÐèÒªÒ»¸ö±à¼­Æ÷¡£³£ÓõÄÓÐ vi , emacs. ÔÚÃüÁîÐÐÉÏÊäÈë vi, emacs, ¡­ ¾Í¿É½øÈë±à¼­»·¾³
¹ØÓÚ vi
¹ØÓÚ EMACS

2) CÓïÑԵıàÒëÆ÷¡£³£ÓõÄÊÇGNUµÄcÓïÑÔ±àÒëÆ÷ gcc(±àÒë C ³ÌÐò), g++(±àÒë C ++³ÌÐò)¡£
¹ØÓÚ gcc / g++
¹ØÓÚ makefile >>>> ÓÃÓÚ¼ò»¯±àÒë¹ý³Ì
ÕâÀïÓÐһƬÈëÃÅÎÄÕ LinuxÏÂCÓïÑÔ±à³Ì»ù´¡ÖªÊ¶£¬¿ÉÒÔÏÈ¿´Ò»ÏÂ

3) µ÷ÊÔ³ÌÐòµÄ³£Óù¤¾ß£ºgdb.
¹ØÓÚ gdb


Get help»ñµÃ°ïÖú£º

¹ØÓÚ Linux µÄÎĵµÊǷdz£·á¸»µÄ¡£×î¿ì½Ý£¬·½±ã£¬È«ÃæµÄ×ÊÁϾÍÔÚÄãµÄ»úÆ÷À²»ÒªÀË·Ñ¡£

ÔÚÃüÁîÐÐÉÏÊäÈëshellÃüÁî man »òÕß info£º
$man gcc >>>> Õâ¸öÃüÁî¿ÉÒÔ»ñµÃGNU µÄCÓïÑÔ±àÒëÆ÷µÄÎĵµ¡£µ±È»£¬ËûÃÇÊÇÓ¢Îĵġ£
¹ØÓÚ man
¹ØÓÚ info

ÍøÂçÉϵÄ×ÊÔ´Ò²ºÜ¶à£¬¶àµÃÒÔÖÁÓÚ²»ÖªµÀʲô²ÅÊÇ×Ô¼º×îÐèÒªµÄ¡£
¹ØÓÚÈçºÎ»ñµÃÓмÛÖµµÄÐÅÏ¢

¿´Ò»Ï loveunix ÉϵÄÏà¹Ø×ÊÔ´ >>>>

ÎÞË«²¹³äµÄһЩLinuxÏÂÈëÃűà³Ì×ÊÁÏ >>>>

¡¡

Basic steps »ù±¾²½Ö裺

1£® ÊäÈëÔ´´úÂë
2£® ±àÒ룬Á´½Ó£¬ÔËÐÐ
3£® µ÷ÊÔ³ÌÐò

ÎÒÃÇ´Ó×î»ù±¾µÄ hello world ³ÌÐò¿ªÊ¼£¬Êµ¼Ê²Ù×÷һϣº

1£® ÊäÈëÔ´´úÂë
ÒýÓÃ

$ emacs hello.c >>>> ½øÈëemacs ±à¼­Æ÷»·¾³

#include >>> Èç¹ûÄã¿´²»¶®Õâ¸öº¯Êý£¬¾ÍÈ¥ºÃºÃµÄ¿´cÓïÑÔµÄÊé
int main()
{
printf(¡°Hello World.\n¡±); >>>> Emacs»·¾³Ï£¬°´Ï Tab ¼ü£¬ÓÐ×Ô¶¯Ëõ½ø¹¦ÄÜ
exit(0);
}


Íê³ÉÊäÈëºó£¬°´×¡CTRL ¼ü£¬°´Ï x, ÔÙ°´Ï c , ×îºóËÉ¿ª CTRL¡£ >>>> ³ÌÐò±£Áô²¢Í˳öemacs »·¾³¡£

2£® ±àÒ룬Á´½Ó£¬ÔËÐÐ

ÒýÓÃ
$ gcc -o hello hello.c
$ ./hello >>>> ./ Ö¸Ã÷ÁËËùÖ´ÐгÌÐòµÄ·¾¶
Hello World.
$

Ò»¸ölinuxƽ̨ÉϵÄc³ÌÐò¿ª·¢ÒѾ­Íê³É¿©

3£® µ÷ÊÔ

Èç¹ûҪʹÓà gdb µ÷ÊÔ³ÌÐò£¬ÄÇôÔÚÉÏÒ»²½±àÒëµÄʱºò£¬¼ÇµÃ¼ÓÉÏ -g Ñ¡Ïî


ÒýÓÃ
$ gcc -g -o hello hello.c
$ gdb hello >>>> ½øÈë gdb µ÷ÊÔ»·¾³

¡¡

4. CVS°æ±¾¿ØÖÆÈí¼þ ---- Эͬ¹¤×÷ºÍ±£Áô°æ±¾µÄ¹¤¾ß
¹ØÓÚ CVS
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 134 ÌõÆÀÂÛ

  1. gonglx ÓÚ 2015-11-14 21:27:20·¢±í:

    ÕæµÄºÜÓÐÓö¥¶¥

  2. geekf ÓÚ 2015-11-09 17:19:07·¢±í:

    (e:e2s

  3. gudeng886 ÓÚ 2013-07-30 17:16:53·¢±í:

    ÊÖ(6)m:b

  4. zzwhjj ÓÚ 2013-07-30 13:40:19·¢±í:

    Êé¼®ÔÚÄÄ¿ÉÒÔÏÂÔØ

  5. chencong ÓÚ 2012-12-29 15:11:08·¢±í:

    ºÃÌù£¬¶¥Ò»Ï£¡£¡£¡

  6. guoyang0601 ÓÚ 2010-12-27 21:07:02·¢±í:

    ¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£

  7. zfj0910 ÓÚ 2010-11-24 16:42:26·¢±í:

    ¿´²»µ½°¡

  8. bingfengshuiye ÓÚ 2010-11-18 10:17:30·¢±í:

    ¶¥Â¥Ö÷

  9. sclzwj ÓÚ 2010-10-27 12:22:14·¢±í:

    ´ó¼Ò¶¼¶¥ÁË£¬ÎÒÔõôÄܲ»¶¥ÄØ¡£

  10. tjmzgn ÓÚ 2010-10-26 14:27:49·¢±í:

    ¾ÍÊÇ´ÓÕâ¸öʱºò¹ýÀ´µÄ£¡

  11. ÃÞ°À¼Ó¶Ì¿ã ÓÚ 2010-09-25 20:41:32·¢±í:

    [code][/code]

  12. Â¥À¼ºóÖ÷ ÓÚ 2010-05-31 11:02:52·¢±í:

    ÊÕÁË

  13. haofree ÓÚ 2010-05-16 11:10:55·¢±í:

    ²»´í

  14. flyaway ÓÚ 2010-05-12 16:20:53·¢±í:

    лл¥Ö÷ÁË£¡

  15. Ì«ÑôÖ®¹â ÓÚ 2010-05-10 12:03:00·¢±í:

    ÓÐÒ»Ò»¶¨µÄÁ˽âÁË???лл·ÖÏí£¡

  16. wolf_d ÓÚ 2010-04-23 15:45:32·¢±í:

    ÊÕµ½£¬Ð»Ð»

  17. ¾²¾²·ÉÎè ÓÚ 2010-04-22 13:42:04·¢±í:

    ÐÂÊÖ¿ÉÒÔ¿´¿´Å¶

  18. 835304205 ÓÚ 2010-04-22 09:53:57·¢±í:

    лл¥Ö÷

  19. ericq2010 ÓÚ 2010-04-22 09:45:08·¢±í:

    cool................

  20. sx-ljm ÓÚ 2010-04-22 07:13:34·¢±í:

    ÊéµÄÏÂÔصØÖ·ÔÚÄÄÀ

  21. tupac ÓÚ 2010-04-21 23:38:55·¢±í:

    ¶¥

  22. bsszr ÓÚ 2010-03-13 22:09:42·¢±í:

    ÔÞÒ»¸ö£¡

  23. jackseaman ÓÚ 2010-03-13 20:24:13·¢±í:

    good thinkings.

  24. beautifularea ÓÚ 2010-03-12 23:23:12·¢±í:

    ÓаïÖú

  25. gudujianxfh ÓÚ 2010-03-08 14:28:17·¢±í:

    Ö§³Ö£¡£¡£¡

  26. qiuyengwo ÓÚ 2010-03-05 00:32:17·¢±í:

    »¹ÒÔΪÊǸöµç×ÓÊé ллLZ

  27. fanyq ÓÚ 2010-02-27 21:28:25·¢±í:

    ͦ»ù´¡µÄ£¬Ð»Ð»lz

  28. xiaoku8891 ÓÚ 2010-02-26 17:43:54·¢±í:

    °ï¶¥Ï¡£¡£Ö§³Ö

  29. ftp0000 ÓÚ 2010-01-28 14:21:02·¢±í:

    ¸Ðлlz·ÖÏí

  30. leiyubingxin ÓÚ 2009-12-24 19:12:49·¢±í:

    С¶¥Ò»ÏÂ

  31. child7 ÓÚ 2009-12-20 18:32:30·¢±í:

    ѧϰ£¬ÊÕ²ØÏÂ

  32. uchiha ÓÚ 2009-12-19 17:24:36·¢±í:

    ¶¥¶¥

  33. cshaoyan ÓÚ 2009-12-03 08:47:16·¢±í:

    Õâ¸öȷʵ¹»³õ¼¶£¬Ð»Ð»

  34. Reachie ÓÚ 2009-12-02 15:45:26·¢±í:

    up

  35. erathia ÓÚ 2009-12-01 14:43:55·¢±í:

    UP

  36. lly20021228 ÓÚ 2009-11-30 23:54:47·¢±í:

    ÐÁ¿àÀ²

  37. huwei025 ÓÚ 2009-11-26 21:48:49·¢±í:

    лл·ÖÏíлл·ÖÏí

  38. 550804556 ÓÚ 2009-11-25 15:02:09·¢±í:

    ¶¥¶¥¶¥

  39. 550804556 ÓÚ 2009-11-25 15:02:03·¢±í:

    ¶¥¶¥¶¥¶¥

  40. 550804556 ÓÚ 2009-11-25 15:01:59·¢±í:

    ¶¥¶¥¶¥¶¥