ÔÚEclipseÖпª·¢C/C++ÏîÄ¿ תÌû
C/C++ development with the Eclipse Platform
Pawel Leszek
ÕªÒª:ͨ¹ý±¾ÎÄÄ㽫»ñµÃÈçºÎÔÚEclipseƽ̨ÉÏ¿ª·¢C/C++ÏîÄ¿µÄ×ÜÌåÈÏʶ¡£ËäÈ»EclipseÖ÷Òª±»ÓÃÀ´¿ª·¢JavaÏîÄ¿£¬µ«ËüµÄ¿ò¼ÜʹµÃËüºÜÈÝÒ×ʵÏÖ¶ÔÆäËû¿ª·¢ÓïÑÔµÄÖ§³Ö¡£ÔÚÕâƪÎÄÕÂÀÄ㽫ѧ»áÈçºÎʹÓÃCDT(C/C++ Development Toolkit)£¬Ò»¸öÔÚEclipseƽ̨ÉÏ×îÊÊÓõÄC/C++¹¤¾ß°ü¡£
C/C++ÓïÑÔÊÇÊÀ½çÉÏ×îÁ÷ÐеijÌÐò¿ª·¢ÓïÑÔ£¬ËùÒÔEclipseÌṩ¶ÔC/C++ÓïÑÔµÄÖ§³ÖÒ²¾Í²»×ãΪÆæÁË¡£ÓÉÓÚEclipseÖ»ÊÇΪ¿ª·¢¹¤¾ßÌṩһ¸ö¿ò¼Ü£¬ËùÒÔËü±ØÐë½èÖúÍⲿ²å¼þµÄÐÎʽʵÏÖ¶ÔC/C++ÓïÑԵļä½ÓÖ§³Ö¡£ÕâƪÎÄÕ¸æËßÄãÈçºÎʹÓÃCDT£¬Ò»¸öÓÃÓÚEclipseƽ̨µÄC/C++¿ª·¢µÄ²å¼þ×é¡£CDTÏîÄ¿(¼û±¾ÎĺóÃæµÄResource²¿·Ö)µÄÄ¿±êÊÇΪEclipseƽ̨Ìṩһ¸öÍêÈ«ÒâÒåÉϵÄC/C++¼¯³É¿ª·¢»·¾³¡£ËäÈ»Õû¸öÏîĿרעÓÚLinuxƽ̨£¬µ«Êµ¼ÊÉÏ£¬ÔÚÄÇЩÌṩÁËGNU¿ª·¢¹¤¾ßµÄƽ̨ÉÏ£¬CDT¶¼¿ÉÒÔÔËÐеúܺ㬰üÀ¨Win32(Win 95/98/Me/NT/2000/XP)£¬QNX NeutrinoºÍSolarisƽ̨µÈ¡£
CDTÊÇÒ»¸ö¿ªÔ´ÏîÄ¿(»ùÓÚCPL)£¬´¿´âÓÉJavaÓïÑÔʵÏÖ¡£ÕâЩ²å¼þÔÚEclipse¹¤×÷ÇøÖÐÌí¼ÓÁËÒ»¸öC/C++¿ª·¢Êӽǣ¬°üÀ¨Ò»ÏµÁеÄÊÓͼ(Views)ºÍÏòµ¼(Wizards)£¬ÒÔ¼°Ò»Ð©¸ß¼¶µÄ±à¼ºÍµ÷ÊÔÖ§³ÖµÈ£¬ÒÔʵÏÖ¶ÔC/C++¿ª·¢µÄÈ«ÃæÖ§³Ö¡£
ÓÉÓÚÆ临ÔÓÐÔ£¬CDT±»·Ö¸îΪÈô¸É¸ö×é¼þ£¬Ã¿Ò»¸ö×é¼þ¶¼ÒÔÒ»¸ö¶ÀÁ¢²å¼þµÄÐÎʽ´æÔÚ¡£Ã¿¸ö×é¼þ¶¼ÊÇÒ»¸ö¶ÀÁ¢µÄÏîÄ¿£¬ÓÐ×Ô¼ºµÄÌá½»Õß¡¢³ô³æ·ÖÀàºÍÓʼþÁбíµÈ¡£µ«ÊÇ£¬Ã¿¸ö×é¼þ¶¼ÊÇCDTÕý³£ÔËÐв»¿É»òȱµÄ¡£ÏÂÃæÊÇÒ»¸öÍêÕûµÄCDT²å¼þÁбí:
l Primary CDT plug-in: ΪCDT²å¼þÌṩһ¸ö¿ò¼Ü£»
l CDT Feature Eclipse: CDTµÄÌØÐÔ×é¼þ£»
l CDT Core: ÌṩºËÐÄÄ£ÐÍ¡¢CDOMºÍºËÐÄ×é¼þ£»
l CDT UI: CDTµÄºËÐÄUI¡¢ÊÓͼ¡¢±à¼Æ÷¡¢Ïòµ¼£»
l CDT Launch: ΪÍⲿ¹¤¾ßÖîÈç±àÒëÆ÷ºÍµ÷ÊÔÆ÷ÌṩLaunch»úÖÆ£»
l CDT Debug Core: Ìṩµ÷ÊÔ¹¦ÄÜ£»
l CDT Debug UI: ΪCDTµ÷ÊÔ±à¼Æ÷¡¢ÊÓͼºÍÏòµ¼ÌṩÓû§½çÃ棻
l &nbs
Ïà¹ØÎĵµ£º
ÁËCÈ»ºóC++£¬È»ºóMFC/Windows,È»ºóÊÇC#,ÆäÖÐÊý¾ÝÀàÐͺܶ࣬ÓÉ»ù±¾ÀàÐÍÑÜÉúµÄtypedefÀàÐÍÒ²N¶à¡£ÊìÖª»ù±¾Êý¾ÝÀàÐÍÊÇÎÒÃÇÕýÈ·±í´ïʵ¼ÊÎÊÌâÖи÷ÖÖÊý¾ÝµÄÇ°ÌᣬÒò´ËÎÒ·ÖÀà×ܽáÁËÒ»ÏÂC/C++/Windows /C#»ù±¾Êý¾ÝÀàÐÍ£¬ÒÔ±ãÈÕºó²éÔÄ¡£
ANSI C/C++»ù±¾Êý¾ÝÀàÐÍ£º
Type
Size
Ê ......
1.ÒýÑÔ
¡¡¡¡C++ÓïÑԵĴ´½¨³õÖÔÊÇ“a better C”£¬µ«ÊÇÕâ²¢²»Òâζ×ÅC++ÖÐÀàËÆCÓïÑÔµÄÈ«¾Ö±äÁ¿ºÍº¯ÊýËù²ÉÓõıàÒëºÍÁ¬½Ó·½Ê½ÓëCÓïÑÔÍêÈ«Ïàͬ¡£×÷ΪһÖÖÓûÓëC¼æÈݵÄÓïÑÔ£¬C++±£ÁôÁËÒ»²¿·Ö¹ý³ÌʽÓïÑÔµÄÌص㣨±»ÊÀÈ˳ÆΪ“²»³¹µ×µØÃæÏò¶ÔÏ󔣩£¬Òò¶øËü¿ÉÒÔ¶¨Òå²»ÊôÓÚÈκÎÀàµÄÈ«¾Ö±äÁ¿ºÍº¯Êý¡£µ«ÊÇ£¬C++±Ï¾ ......
http://man.lupaworld.com/content/develop/c&c++/c/c.htm
1. Èç¹û²ÎÊýÊÇÖ¸Õ룬ÇÒ½ö×÷ÊäÈëÓã¬ÔòÓ¦ÔÚÀàÐÍÇ°¼Óconst£¬ÒÔ·ÀÖ¹¸ÃÖ¸ÕëÔÚº¯ÊýÌåÄÚ±»ÒâÍâÐÞ¸Ä
2. ÔÚº¯ÊýÌåµÄ“Èë¿Ú´¦”£¬¶Ô²ÎÊýµÄÓÐЧÐÔ½øÐмì²é
ÔÚº¯ÊýÌåµÄ“³ö¿Ú´¦”£¬¶ÔreturnÓï¾äµÄÕýÈ·ÐÔºÍЧÂʽøÐмì ......
C¿âº¯Êý
×Ö·û´®º¯Êý
º¯ÊýÃû
º¯ÊýÔÐÍ
¹¦ÄÜ
·µ»ØÖµ
°üº¬Í·Îļþ
strcat
char *strcat(char *st1, char *str2)
°Ñstr2Á¬½Óµ½str1ºóÃæ
str1
string.h
strchr
char *strchr(char *str, int ch)
ÕÒ³östrÖ¸ÏòµÄ×Ö·û´®ÖеÚÒ»´Î³öÏÖ×Ö·û´®chµÄλÖÃ
Ö¸Ïò¸ÃλÖõÄÖ¸Õ룬δÕÒµ½Ôò·µ»Ø¿ÕÖ¸Õë
......
extern "C" °üº¬Ë«Öغ¬Ò壬´Ó×ÖÃæÉϼ´¿ÉµÃµ½£ºÊ×ÏÈ£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“extern”µÄ£»Æä´Î£¬±»ËüÐÞÊεÄÄ¿±êÊÇ“C”µÄ¡£ÈÃÎÒÃÇÀ´Ïêϸ½â¶ÁÕâÁ½Öغ¬Òå¡£
¡¡¡¡£¨1£© ±»extern "C"ÏÞ¶¨µÄº¯Êý»ò±äÁ¿ÊÇexternÀàÐ͵ģ»
¡¡¡¡externÊÇC/C++ÓïÑÔÖбíÃ÷º¯ÊýºÍÈ«¾Ö±äÁ¿×÷Ó÷¶Î§£¨¿É¼ûÐÔ£©µÄ¹Ø¼ü×Ö£¬¸Ã¹Ø¼ü×Ö¸æËß±àÒ ......