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

ÇáËɾÍÄÜÈÃLinuxϵÄC±à³Ì´ÓÍ·À´

·¢²¼Ê±¼ä:2005-12-29 09:39:51À´Ô´:ºìÁª×÷Õß:ºÎ¸ç
¡¡¡¡ÎÒÃÇ´Ó×î»ù±¾µÄ hello world ³ÌÐò¿ªÊ¼£¬Êµ¼Ê²Ù×÷һϣº

1£® ÊäÈëÔ´´úÂë

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

#include >>> Èç¹ûÄã¿´²»¶®Õâ¸öº¯Êý£¬¾ÍÈ¥ºÃºÃµÄ¿´cÓïÑÔµÄÊé

int main()

{

rintf(¡°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 µ÷ÊÔ»·¾³
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 3 ÌõÆÀÂÛ

  1. tracydundun ÓÚ 2008-04-08 22:23:12·¢±í:

    ÕýÔÚѧ,µ«C ÓïÑÔ»ù´¡±È½Ï²î,ÓÐЩͷÎļþ²»ÖªµÀΪʲô,±ÈÈç#ifndef #endif #ifdef ÇëÖ¸½Ì,½éÉÜÒ»±¾ÊéÒ²¿ÉÒÔ

  2. xinglight ÓÚ 2008-04-08 06:56:14·¢±í:

    лл·ÖÏí

  3. hongmaojin ÓÚ 2008-03-27 20:42:08·¢±í:

    ÕýÔÚѧϰ£¬¸ÐÊÜÆĶ࣬лл·ÖÏí