? ËùÐè¾ß±¸µÄ±³¾°ÖªÊ¶
? ¿ª·¢ËùÐèµÄ»ù±¾»·¾³
? »ñµÃ°ïÖúµÄ;¾¶
? ͨ¹ýÒ»¸öʵÀýÁ˽â»ù±¾²½Öè
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
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
lwinon ÓÚ 2005-11-04 22:10:46·¢±í:
ÆÚÍûÓиü¶à
win-linux ÓÚ 2005-11-01 00:28:21·¢±í:
ºÜºÃ
ÐǹâÒÀÈ» ÓÚ 2005-10-11 00:31:52·¢±í:
Ö§³Ö
koov ÓÚ 2005-09-19 10:55:40·¢±í:
ºÃÎÄÕÂ
linux ÓÚ 2005-08-22 00:30:49·¢±í:
´Ó0¿ªÊ¼
chentong ÓÚ 2005-07-25 00:15:25·¢±í:
¶¥
zz123 ÓÚ 2005-06-29 00:14:41·¢±í:
¶¥
HR ÓÚ 2005-06-18 16:10:37·¢±í:
¡±1£® CÓïÑԵıà³Ì»ù´¡£¬ÖÁÉÙÒªÖªµÀһЩ»ù±¾µÄÓï·¨£¬¿ØÖÆÁ÷³ÌµÈ±à³Ì³£Ê¶¡£
¶Ô³£Óõıê×¼ C º¯Êý¿âÓг£Ê¶ÐÔµÄÁ˽⡣¡°¡£¡£¡£¡£¡£ÎÒÏëÂò±¾ÊéÀ´¿´¿´£¬ÇëÎÊÄı¾Êé½ÏÊʺÏ0»ù´¡µÄ¶ÁÕßѧϰCÓïÑÔ¡£µ±È»ÍøÉÏÒ²ÓÐÕâ·½ÃæµÄ×ÊÁÏ£¬²»¹ý»¹ÊÇÖ½Ó¡µÄÊé±ãÓÚÔĶÁ¡£
ÖйúÈË ÓÚ 2005-06-18 01:08:54·¢±í:
ºÃÎÄ
ÐÂРÓÚ 2005-06-07 14:26:51·¢±í:
ÎÒ¶¥
007 ÓÚ 2005-06-01 00:28:36·¢±í:
ꝃ즴
cooc ÓÚ 2005-05-29 00:16:59·¢±í:
UP
·çÓêÎÞ×è ÓÚ 2005-05-22 00:16:15·¢±í:
¶¥
yangzi ÓÚ 2005-05-10 09:29:25·¢±í:
¶àл£¬ÊÕµ½¡£