ºìÁª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. ssc ÓÚ 2007-01-06 11:52:19·¢±í:

    лÁË

  2. µÂÀï¿Ë ÓÚ 2007-01-05 15:52:06·¢±í:

    :0)1 ÄܸüÏêϸµãÂð

  3. jakepain ÓÚ 2007-01-05 11:29:40·¢±í:

    ÂÛ̳ºÃ¶àÀíÂÛÐÔÎÄÕÂÎÒ¶¼²»¶®
    ÀÏÐÖµÄÀý×ӺܺÃ
    ÊʺϳõѧÕß

  4. Emperor ÓÚ 2006-12-23 10:30:26·¢±í:

    LinuxϵÄcÓïÑԺܺÃѽ

  5. ljcheng200888 ÓÚ 2006-12-04 15:22:08·¢±í:

    ÒýÓÃ:
    Ô­ÌûÓÉ HR ÓÚ 2005-6-18 16:10 ·¢±í
    ¡±1£® CÓïÑԵıà³Ì»ù´¡£¬ÖÁÉÙÒªÖªµÀһЩ»ù±¾µÄÓï·¨£¬¿ØÖÆÁ÷³ÌµÈ±à³Ì³£Ê¶¡£
    ¶Ô³£Óõıê×¼ C º¯Êý¿âÓг£Ê¶ÐÔµÄÁ˽⡣¡°¡£¡£¡£¡£¡£ÎÒÏëÂò±¾ÊéÀ´¿´¿´£¬ÇëÎÊÄı¾Êé½ÏÊʺÏ0»ù´¡µÄ¶ÁÕßѧϰCÓïÑÔ¡£µ±È»ÍøÉÏÒ²ÓÐÕâ·½ÃæµÄ ...

    ÊÇ°¡£¬ºÇºÇ£¬ÎÒÒ²ÏëÂòÒ»±¾0»ù´¡µÄcÓïÑԽ̲ģ¬ÄÇλ¸ßÈËÄܸøÍƼöÒ»±¾°¡£¿

  6. wjyongjiang ÓÚ 2006-12-04 00:18:41·¢±í:

    fjdklsafij

  7. weiweiwei21 ÓÚ 2006-12-03 19:49:10·¢±í:

    ¶¥

  8. hylingzhi ÓÚ 2006-12-03 16:20:18·¢±í:

    hao ding

  9. 72.232.206.* ÓÚ 2006-11-29 09:54:21·¢±í:

    Good design!
    http://wzukekab.com/zirv/pqiy.html | http://pybpkqcr.com/yauj/nfzu.html

  10. 72.36.178.* ÓÚ 2006-11-29 09:54:16·¢±í:

    Thank you!
    My homepage | Please visit

  11. 72.36.178.* ÓÚ 2006-11-29 09:54:12·¢±í:

    Thank you!
    My homepage | Cool site

  12. spacesky ÓÚ 2006-11-28 15:11:20·¢±í:

    :0L
    ºÍÔÚWINDOWSÏÂÓкܴóÇø±ðµÄ°¡

  13. resky ÓÚ 2006-11-27 18:24:55·¢±í:

    ÉÏÈ¥

  14. zouyyong782211 ÓÚ 2006-11-23 15:09:09·¢±í:

    3k

  15. lovefengzi ÓÚ 2006-11-21 11:24:47·¢±í:

    thanks

  16. guixiaolan ÓÚ 2006-11-18 15:03:25·¢±í:

    Ò»¶Ñ²ÎÊý²»ÖªµÀÔõôÓÃ?
    »¹²»ÈçÓÃTC

  17. chunyu ÓÚ 2006-11-16 16:11:59·¢±í:

    Ò»Ö±À§»óLinuxϱà³Ì£¬Ð»Ð»°¡

  18. mail11758332 ÓÚ 2006-11-15 16:40:34·¢±í:

    :0L

  19. ColorÍà ÓÚ 2006-11-15 14:23:50·¢±í:

    ѧϰÖÐ...

  20. rainofwind ÓÚ 2006-11-09 11:44:19·¢±í:

    :0L

  21. wymam ÓÚ 2006-11-08 17:57:11·¢±í:

    ÒÔÇ°ÔÚwindowsÏÂѧµÄ²»ÊǺܺ㬵«ÊDz»ÖªµÀÏÖÔÚÀ´Ñ§»á²»»á³ÙÁËÄØ£¡

  22. ÓÚ 2006-11-06 05:48:34·¢±í:

    ÎÒ¶¥£¬Ð´µÄÕæºÃ£¬Í¨Ë×Ò׶®£¬ÎÒ¸ÕÓÃlinux:0L

  23. ÀîÒ» ÓÚ 2006-10-24 08:53:39·¢±í:

    лл :0L

  24. davidpike ÓÚ 2006-10-23 15:00:54·¢±í:

    ÕýÏëÁ˽âÒ»ÏÂÕâ·½ÃæµÄ֪ʶÄØ£¡

  25. hurt90 ÓÚ 2006-10-23 09:10:34·¢±í:

    ²»¹ý£¬ÎÒ¾õµÃ»¹ÊÇvim±à³Ì±È½ÏºÃ£¬ËäÈ»ÊÇÈ«×Ö·û½çÃ棬

  26. open.wood ÓÚ 2006-10-22 20:59:27·¢±í:

    ¶¥

  27. ÓÚ 2006-10-21 12:01:55·¢±í:

    ºÃÎÄ

  28. ly8683783 ÓÚ 2006-10-21 09:47:54·¢±í:

    ÓÐûÓйØÓÚC¿âº¯ÊýµÄÊé°¡£¿£¿½éÉÜÒ»±¾Äå

  29. jzlk ÓÚ 2006-10-19 15:08:11·¢±í:

  30. xinlaoda ÓÚ 2006-10-16 15:58:56·¢±í:

    ÏëѧÕâ·½ÃæµÄ֪ʶ,¿Éϧ»ù´¡±È½Ï²î,Äܲ»ÄÜÍƼöЩÊéÄØ?

  31. yang1993 ÓÚ 2006-10-15 00:08:49·¢±í:

    ¶¥ÁË

  32. 2410linux ÓÚ 2006-10-13 18:24:40·¢±í:

    hao

  33. jamako ÓÚ 2006-09-28 09:58:59·¢±í:

    ²»´í£¬Ð»Ð»

  34. °®ÎÞ½ûÑÔ ÓÚ 2006-09-27 12:57:37·¢±í:

    °¥~~~~~~~С¶¥Ò»ÏÂ~~~~~~~!!!!!!!!!!!!!!

  35. ǧֽº× ÓÚ 2006-09-27 10:19:32·¢±í:

    ºÃ¶«Î÷

  36. cailiao626 ÓÚ 2006-08-26 09:47:55·¢±í:

    ´ÓÁãÆð²½

  37. »µ»µ´óÉÙ ÓÚ 2006-08-23 21:25:50·¢±í:

    ÎÒ½ñÌì¸Õ×°ÁË LINUX ÏÖÔÚ¶ÔËü»¹Ê²Ã´¶¼²»¶® µ« C »¹ÊÇÁ˽âµÄ ¿´À´ÒªºÃºÃѧѧ LINUX ÁË

  38. forfree ÓÚ 2006-08-22 10:33:18·¢±í:

    ²»¶¥²»ÐÐ

  39. minny ÓÚ 2006-08-21 19:11:15·¢±í:

    ÓÐÊÕ»ñ~

  40. xiaomao2000 ÓÚ 2006-04-25 21:32:18·¢±í:

    ÇóÖú:
    ÎÒÊÇÒ»Ãû´óËÄѧÉú,±ÏÒµÉè¼ÆÊÇ×ö¹ØÓÚlinux²Ù×÷ϵͳ±à³Ì,µ«linux·½ÃæÎÒÊÇÃÅÍ⺺,¿ìÒª´ð±çÁËÉõÊÇ׿±,ÇóÖú¸÷λ¸ßÊÖ°ïæ,ÎÒÐèÒªÁ½¸ö¼òµ¥µÄ³ÌÐò1.»ùÓÚlinux²Ù×÷ϵͳµÄÄÚ´æ¹ÜÀíµÄʵÑéµÄ³ÌÐò2.»ùÓÚlinux²Ù×÷ϵͳÎļþϵͳ¹ÜÀíµÄʵÑéµÄ³ÌÐò. ÇëÇóÄÄλºÃÐĸßÊÖÄÜ°ï°ïÎÒ,ÓÐÏà¹Ø³ÌÐò·¢µç×ÓÓʼþ¸øÎÒ,³ÌÐòÔ½¼òµ¥Ô½ºÃ,×îºÃÄܰѳÌÐò·ÅÔÚwordÀ︽ÓгÌÐò˵Ã÷,¸Ð¼¤²»¾¡°¡!!!!!Îҵĵç×ÓÓʼþÊÇxiaomao19831202@126.com