? ËùÐè¾ß±¸µÄ±³¾°ÖªÊ¶
? ¿ª·¢ËùÐèµÄ»ù±¾»·¾³
? »ñµÃ°ïÖúµÄ;¾¶
? ͨ¹ýÒ»¸öʵÀýÁ˽â»ù±¾²½Öè
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
RED_CSHAT ÓÚ 2009-11-25 13:18:21·¢±í:
Õä²Ø
lightyear ÓÚ 2009-11-19 16:41:00·¢±í:
Â¥Ö÷µÄ½éÉÜÄܲ»ÄÜÔÙ¾ßÌåһЩ
ybg0631 ÓÚ 2009-11-19 14:31:21·¢±í:
¸Ð¾õºÜºÃ ¶¥
linuxapple ÓÚ 2009-11-18 22:45:22·¢±í:
ºÃ
dert ÓÚ 2009-10-10 17:18:07·¢±í:
¶¥
Knight_yj ÓÚ 2009-10-10 09:36:51·¢±í:
¶¥Æð
pzcxujia ÓÚ 2009-10-10 09:23:38·¢±í:
Ö§³Ö
rxy24 ÓÚ 2009-10-09 18:12:19·¢±í:
ѧϰÁË~
yitian2000 ÓÚ 2009-10-08 17:13:19·¢±í:
л£¡ÕýÏëѧѧC°¢
huwei025 ÓÚ 2009-10-07 09:44:10·¢±í:
10# chentong¶¨
liu351128 ÓÚ 2009-10-05 22:04:25·¢±í:
¶ÔÐÂÊÖºÜÓÐÓÃ
rxy24 ÓÚ 2009-10-05 21:28:56·¢±í:
ºÇºÇºÇ~~¶¥~
iltwq ÓÚ 2009-09-26 21:35:42·¢±í:
ºÜºÃ£¬Ñ§Ï°ÁË
wenzq ÓÚ 2009-09-25 14:41:11·¢±í:
дµÄºÜÇåÎúºÍÒ׶® лл£¡
realzheng ÓÚ 2009-09-18 23:14:25·¢±í:
ѧϰÁË
js001sdx ÓÚ 2009-09-17 15:50:10·¢±í:
10# chentong
UP!UP!UP!UP!UP!
diaodazhi ÓÚ 2009-09-14 16:15:03·¢±í:
Ì·ºÆÇ¿µÄ C³ÌÐòÉè¼Æ
qiner ÓÚ 2009-08-28 18:46:16·¢±í:
¶¥
zcc1984 ÓÚ 2009-07-24 11:23:26·¢±í:
ÊÕÏÂ
hice0000 ÓÚ 2009-07-22 14:37:48·¢±í:
ѧϰÖС£¡£¡£
balini ÓÚ 2009-07-22 14:33:53·¢±í:
¶¥
guilincxl ÓÚ 2008-06-29 20:02:55·¢±í:
лл·ÖÏí
unicafree ÓÚ 2008-06-25 17:07:20·¢±í:
¾ÍÕâÑù¾ÍÍêÍêÁËÂ𣬻¹ÓÐʲô¶«Î÷Âð
yannanfei169 ÓÚ 2008-06-25 15:57:48·¢±í:
¿´¿´ÁË
Gones ÓÚ 2008-06-14 19:05:43·¢±í:
I did it just now.
From the screen,i see "Hello world".
It's great.
zzl7709 ÓÚ 2008-06-11 16:54:30·¢±í:
OK
Y2K ÓÚ 2007-05-22 15:20:57·¢±í:
Õâ¾ÍûÁË°¡£¬Ì«ÉÙÁË°¡
addlyl ÓÚ 2007-05-20 22:06:49·¢±í:
:handshake ¶¥ÁË£¬¿´²»µ½Êéѽ£¬ÊDz»ÊÇȨÏÞ²»¹»Ñ½
¸øÎÒ·¢Ò»¸öÁË
Gpoyinsnbo ÓÚ 2007-04-18 10:51:56·¢±í:
лл·ÖÏí
geniusmali ÓÚ 2007-03-29 14:26:41·¢±í:
Ôõô¿´²»µ½ÏÂÔØÁ´½Ó°¡£¿
geniusmali ÓÚ 2007-03-29 14:26:10·¢±í:
¡±1£® CÓïÑԵıà³Ì»ù´¡£¬ÖÁÉÙÒªÖªµÀһЩ»ù±¾µÄÓï·¨£¬¿ØÖÆÁ÷³ÌµÈ±à³Ì³£Ê¶¡£
¶Ô³£Óõıê×¼ C º¯Êý¿âÓг£Ê¶ÐÔµÄÁ˽⡣¡°¡£¡£¡£¡£¡£ÎÒÏëÂò±¾ÊéÀ´¿´¿´£¬ÇëÎÊÄı¾Êé½ÏÊʺÏ0»ù´¡µÄ¶ÁÕßѧϰCÓïÑÔ¡£µ±È»ÍøÉÏÒ²ÓÐÕâ·½ÃæµÄ×ÊÁÏ£¬²»¹ý»¹ÊÇÖ½Ó¡µÄÊé±ãÓÚÔĶÁ¡£
honckly ÓÚ 2007-02-14 01:17:02·¢±í:
ÊܽÌÁË£¡£¡:0L
ph_degrees ÓÚ 2007-02-10 20:55:32·¢±í:
LINUXµÄCÓïÑԵıà³Ì»ù´¡ÄÄÓÐÂô
monther ÓÚ 2007-01-26 10:38:00·¢±í:
ºÃ£¬?
honckly ÓÚ 2007-01-17 17:40:43·¢±í:
´Óo¿ªÊ¼£¡£¡Ò»¶¨Òª¼á³Ö£¡£¡£¡
linuxeden ÓÚ 2007-01-13 22:16:02·¢±í:
:0L
ллÌṩÊÕÏÂÁË
twwlx101 ÓÚ 2007-01-11 08:43:01·¢±í:
:mad:1
ÎÒÒ²ÊÇ°´ÕÕÕâ¸ö·½·¨×öµÄ
¿ÉÊÇÕÒ²»µ½hello.cÕâ¸öÎļþ
chris_cheng ÓÚ 2007-01-10 13:13:09·¢±í:
Ïêϸ£¬¼òµ¥~£¡
twwlx101 ÓÚ 2007-01-09 08:13:57·¢±í:
ÎÒÔõôʲôҲû¿´µ½ÄØ£¿
ºÇºÇ
ÃÔ;СÊéͯ ÓÚ 2007-01-08 10:11:58·¢±í:
·Ç³£¸Ðл£¡£¡£¡