Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

GCC ÐÂÊÖ c/c++

±¾ÎÄÊÇд¸ø gcc ÐÂÊÖµÄÈëÃÅÎÄÕ£¬ËùÒÔÄÚÈݱȽϼòµ¥¡£Èç¹ûÄãÖªµÀÏÂÃæ3ÌõÃüÁ¿ÉÒÔ±àÒëc++µÄ»°£¬¾Í²»ÓÃÔÚ±¾ÎÄÀË·Ñʱ¼äÁË
´úÂë:
g++ -Wall hellocpp.cpp
gcc -Wall hellocpp.cpp -lstdc++
gfortran -Wall hellocpp.cpp -lstdc++
×¢£º±¾ÎÄ×îаæÔÚwikiÖÐ http://wiki.ubuntu.org.cn/Gcchowto
£¨½¨Òé´ó¼ÒÖ±½Ó·ÃÎÊwikiÖеİ汾£©
Èç¹ûÄãÏëÕÒÒ»¸ö¼¯³É¿ª·¢»·¾³£¬¿É·ÃÎÊ
http://wiki.ubuntu.org.cn/C_Cpp_IDE
Èç¹ûÒª´î½¨Gtk»òQt±àÒë»·¾³£¬¿É·ÃÎÊ http://wiki.ubuntu.org.cn/GtkÓëQt±àÒë»·¾³°²×°ÓëÅäÖÃ
×¢Ò⣺
¿ªÊ¼Ö®Ç°ÇëÈ·±£ÒѾ­°²×°ÁË build-essential Èí¼þ°ü
±àÒë¼òµ¥µÄ C ³ÌÐò
C ÓïÑÔ¾­µäµÄÈëÃÅÀý×ÓÊÇ Hello World£¬ÏÂÃæÊÇһʾÀý´úÂ룺
´úÂë:
#include <stdio.h>
int
main(void)
{
  printf("Hello, world!\n");
  return 0;
}
ÎÒÃǼٶ¨¸Ã´úÂë´æΪÎļþ‘hello.c’¡£ÒªÓà gcc
±àÒë¸ÃÎļþ£¬Ê¹ÓÃÏÂÃæµÄÃüÁ
´úÂë:
$ gcc -Wall hello.c -o hello
¸ÃÃüÁÎļþ‘hello.c’ÖеĴúÂë±àÒëΪ»úÆ÷Âë²¢´æ´¢ÔÚ¿ÉÖ´ÐÐÎļþ ‘hello’ÖС£»úÆ÷ÂëµÄÎļþÃûÊÇͨ¹ý -o
Ñ¡ÏîÖ¸¶¨µÄ¡£¸ÃÑ¡Ïîͨ³£×÷ΪÃüÁîÐÐÖеÄ×îºóÒ»¸ö²ÎÊý¡£Èç¹û±»Ê¡ÂÔ£¬Êä³öÎļþĬÈÏΪ ‘a.out’¡£
×¢Òâ
µ½Èç¹ûµ±Ç°Ä¿Â¼ÖÐÓë¿ÉÖ´ÐÐÎļþÖØÃûµÄÎļþÒѾ­´æÔÚ£¬Ëü½«±»¸´¸Ç¡£
Ñ¡Ïî -Wall
¿ªÆô±àÒëÆ÷¼¸ºõËùÓг£Óõľ¯¸æ©¤©¤Ç¿ÁÒ½¨ÒéÄãʼÖÕʹÓøÃÑ¡Ïî
¡£±àÒëÆ÷ÓкܶàÆäËûµÄ¾¯¸æÑ¡Ïµ« -Wall
ÊÇ×î³£Óõġ£Ä¬ÈÏÇé¿öÏÂGCC ²»»á²úÉúÈκξ¯¸æÐÅÏ¢¡£µ±±àд C »ò C++ ³ÌÐòʱ±àÒëÆ÷¾¯¸æ·Ç³£ÓÐÖúÓÚ¼ì²â³ÌÐò´æÔÚµÄÎÊÌâ¡£
±¾ÀýÖУ¬±àÒëÆ÷ʹÓÃÁË -Wall
Ñ¡Ïî¶øû²úÉúÈκξ¯¸æ£¬ÒòΪʾÀý³ÌÐòÊÇÍêÈ«ºÏ·¨µÄ¡£
ÒªÔËÐиóÌÐò£¬ÊäÈë¿ÉÖ´ÐÐÎļþµÄ·¾¶ÈçÏ£º
´úÂë:
$ ./hello
Hello, world!
Õ⽫¿ÉÖ´ÐÐÎļþÔØÈëÄڴ棬²¢Ê¹ CPU ¿ªÊ¼Ö´ÐÐÆä°üº¬µÄÖ¸Áî¡£ ·¾¶ ./
Ö¸´úµ±Ç°Ä¿Â¼£¬Òò´Ë ./hello ÔØÈë²¢Ö´Ðе±Ç°Ä¿Â¼ÏµĿÉÖ´ÐÐÎļþ ‘hello’¡£
²¶×½´íÎó
ÈçÉÏËùÊö£¬µ±Óà C »ò C++ ±à³Ìʱ£¬±àÒëÆ÷¾¯¸æÊǷdz£ÖØÒªµÄÖúÊÖ¡£ÎªÁË˵Ã÷ÕâÒ»µã£¬ÏÂÃæµÄÀý×Ó°üº¬Ò»¸ö΢ÃîµÄ´íÎó£ºÎªÒ»¸öÕûÊýÖµ´íÎóµØÖ¸¶¨ÁËÒ»¸¡µãÊý¿ØÖÆ·û‘%f’¡£
´úÂë:
#include <stdio.h>
int
main (void)
{
  printf ("Two plus two is %f\n", 4);
  return 0;
}
Ò»ÑÛ¿´È¥¸Ã´íÎó²¢²»Ã÷ÏÔ£¬µ«ÊÇËü¿É±»


Ïà¹ØÎĵµ£º

C# C/S³ÌÐò³ö´í£ºContextSwitchDeadlock is detected

½ñÌìÔÚVS2005µ÷ÊÔÒ»¸öC# C/S³ÌÐò£¬µ±Í¨¹ýRFCÓëSAPÁ¬½Óʱ¼ä¹ý³¤Ê±£¬³öÏÖ´Ë´íÎó£¬ÔÚÍøÉÏÕÒµ½½â¾ö°ì·¨¡£
VS2008ÉϵÄÒ»¸ö³ÌÐò£¬Í¨¹ýOracle.DataAccess.dllÖ´ÐÐdrop user
cascade²Ù×÷£¬ÎÒÔÚsqlplusÖ´Ðд˲Ù×÷´óÔ¼ÐèÒªÒ»·ÖÖÓ×óÓÒʱ¼ä£¬µ±ÎÒÔÚVS2008ÖÐdebugÆô¶¯´Ë³ÌÐòʱ£¬Ò»Ö±½ÓÊÕµ½
“ContextSwitchDeadlock is detected& ......

[ת]ubuntuÏÂc£¯c++¿ª·¢»·¾³ÅäÖÃ

ubuntuϵÄc/c++»·¾³´î½¨ÊDZȽϼòµ¥,ÒòΪÓÐaptºÍÐÂÁ¢µÃµÄ°ïÖú.
1.
Ê×ÏÈÊÇÅäÖÃgcc,ÔÚubuntu°²×°Íê³ÉÒѾ­ÓÐgccÁË(gccÊÇÓÉGNUÖ®¸¸StallmanËù¿ª·¢µÄlinuxϵıàÒëÆ÷£¬È«³ÆΪGNU
Compiler Collection£¬ Ä¿Ç°¿ÉÒÔ±àÒëµÄÓïÑÔ°üÀ¨£ºC, C++, Objective-C, Fortran, Java,
and
Ada.).µ«ÊÇgcc»¹²»ÄܱàÒëÎļþ.ÒòΪȱÉÙһЩͷÎļþ.Ä ......

ÉîÈëÀí½âextern "C"

Ò»¡¢´ÓCÓëC++±àÒëÁ¬½Ó·½Ê½ÉîÈëÀí½âextern "C"
<1>.CºÍC++¶Ôº¯ÊýµÄ´¦Àí·½Ê½ÊDz»Í¬µÄ.±»extern "C"ÐÞÊεıäÁ¿ºÍº¯ÊýÊÇ°´ÕÕCÓïÑÔ·½Ê½±àÒëºÍÁ¬½ÓµÄ.extern "C"ÓÃÓÚʵÏÖC++ÓëC¼°ÆäËüÓïÑԵĻìºÏ±à³Ì¡£
<2>.δ¼Óextern “C”ÉùÃ÷ʱµÄ±àÒ뷽ʽ
Ê×ÏÈ¿´¿´C++ÖжÔÀàËÆCµÄº¯ÊýÊÇÔõÑù±àÒëµÄ¡£
×÷ΪһÖÖÃæÏò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ