C/C++¶¨ÒåÈ«¾Ö±äÁ¿/³£Á¿¼¸ÖÖ·½·¨µÄÇø±ð
. ±àÒëµ¥Ôª(Ä£¿é)£º
ÔÚIDE¿ª·¢¹¤¾ß´óÐÐÆäµÀµÄ½ñÌ죬¶ÔÓÚ±àÒëµÄһЩ¸ÅÄîºÜ¶àÈËÒѾ²»ÔÙÇå³þÁË£¬ºÜ¶à³ÌÐòÔ±×îŵľÍÊÇ´¦ÀíÁ¬½Ó´íÎó(LINK ERROR), ÒòΪËü²»Ïñ±àÒë´íÎóÄÇÑù¿ÉÒÔ¸ø³öÄã³ÌÐò´íÎóµÄ¾ßÌåλÖã¬Äã³£³£¶ÔÕâÖÖ´íÎó¸Ðµ½°ÃÄÕ£¬µ«ÊÇÈç¹ûÄã¾³£Ê¹ÓÃgcc£¬makefileµÈ¹¤¾ßÔÚlinux»òÕßǶÈëʽÏÂ×ö¿ª·¢¹¤×÷µÄ»°£¬ÄÇôÄã¿ÉÄܷdz£µÄÀí½â±àÒëÓëÁ¬½ÓµÄÇø±ð£¡µ±ÔÚVCÕâÑùµÄ¿ª·¢¹¤¾ßÉϱàдÍê´úÂ룬µã»÷±àÒë°´Å¥×¼±¸Éú³ÉexeÎļþʱ£¬VCÆäʵ×öÁËÁ½²½¹¤×÷£¬µÚÒ»²½£¬½«Ã¿¸ö.cpp(.c)ºÍÏàÓ¦.hÎļþ±àÒë³ÉobjÎļþ£»µÚ¶þ²½£¬½«¹¤³ÌÖÐËùÓеÄobjÎļþ½øÐÐLINKÉú³É×îÖÕµÄ.exeÎļþ£¬ÄÇô´íÎó¾ÍÓпÉÄÜÔÚÁ½¸öµØ·½²úÉú£¬Ò»¸öÊDZàÒëʱµÄ´íÎó£¬Õâ¸öÖ÷ÒªÊÇÓï·¨´íÎó£¬ÁíÒ»¸öÊÇÁ¬½Ó´íÎó£¬Ö÷ÒªÊÇÖظ´¶¨Òå±äÁ¿µÈ¡£ÎÒÃÇËù˵µÄ±àÒëµ¥Ôª¾ÍÊÇÖ¸ÔÚ±àÒë½×¶ÎÉú³ÉµÄÿ¸öobjÎļþ£¬Ò»¸öobjÎļþ¾ÍÊÇÒ»¸ö±àÒëµ¥Ôª£¬Ò²¾ÍÊÇ˵һ¸öcpp(.c)ºÍËüÏàÓ¦µÄ.hÎļþ¹²Í¬×é³ÉÁËÒ»¸ö±àÒëµ¥Ôª£¬Ò»¸ö¹¤³ÌÓɺܶà¸ö±àÒëµ¥Ôª×é³É£¬Ã¿¸öobjÎļþÀï°üº¬Á˱äÁ¿´æ´¢µÄÏà¶ÔµØÖ·µÈ ¡£
2. ÉùÃ÷Ó붨ÒåµÄÇø±ð
º¯Êý»ò±äÁ¿ÔÚÉùÃ÷ʱ£¬²¢Ã»ÓиøËüʵ¼ÊµÄÎïÀíÄÚ´æ¿Õ¼ä£¬ËüÓÐʱºò¿ÉÒÔ±£Ö¤ÄãµÄ³ÌÐò±àÒëͨ¹ý£¬ µ«Êǵ±º¯Êý»ò±äÁ¿¶¨ÒåµÄʱºò£¬Ëü¾ÍÔÚÄÚ´æÖÐÓÐÁËʵ¼ÊµÄÎïÀí¿Õ¼ä£¬Èç¹ûÄãÔÚ±àÒëÄ£¿éÖÐÒýÓõÄÍⲿ±äÁ¿Ã»ÓÐÔÚÕû¸ö¹¤³ÌÖÐÈκÎÒ»¸öµØ·½¶¨ÒåµÄ»°£¬ ÄÇô¼´Ê¹ËüÔÚ±àÒëʱ¿ÉÒÔͨ¹ý£¬ÔÚÁ¬½ÓʱҲ»á±¨´í£¬ÒòΪ³ÌÐòÔÚÄÚ´æÖÐÕÒ²»µ½Õâ¸ö±äÁ¿£¡ÄãÒ²¿ÉÒÔÕâÑùÀí½â£¬ ¶Ôͬһ¸ö±äÁ¿»òº¯ÊýµÄÉùÃ÷¿ÉÒÔÓжà´Î£¬¶ø¶¨ÒåÖ»ÄÜÓÐÒ»´Î!
3. externµÄ×÷ÓÃ
externÓÐÁ½¸ö×÷Ó㬵ÚÒ»¸ö,µ±ËüÓë"C"Ò»ÆðÁ¬ÓÃʱ£¬Èç: extern "C" void fun(int a, int b); Ôò¸æËß±àÒëÆ÷ÔÚ±àÒëfunÕâ¸öº¯ÊýÃûʱ°´×ÅCµÄ¹æÔòÈ¥·ÒëÏàÓ¦µÄº¯ÊýÃû¶ø²»ÊÇC++µÄ£¬ C++µÄ¹æÔòÔÚ·ÒëÕâ¸öº¯ÊýÃûʱ»á°ÑfunÕâ¸öÃû×Ö±äµÃÃæÄ¿È«·Ç£¬¿ÉÄÜÊÇfun@aBc_int_int#%$Ò²¿ÉÄÜÊDZðµÄ£¬ÕâÒª¿´±àÒëÆ÷µÄ"Æ¢Æø"ÁË(²»Í¬µÄ±àÒëÆ÷²ÉÓõķ½·¨²»Ò»Ñù)£¬ÎªÊ²Ã´Õâô×öÄØ£¬ÒòΪC++Ö§³Öº¯ÊýµÄÖØÔØ°¡£¬ÔÚÕâÀﲻȥ¹ý¶àµÄÂÛÊöÕâ¸öÎÊÌ⣬Èç¹ûÄãÓÐÐËȤ¿ÉÒÔÈ¥ÍøÉÏËÑË÷£¬ÏàÐÅÄã¿ÉÒԵõ½ÂúÒâµÄ½âÊÍ!
µ±extern²»Óë"C"ÔÚÒ»ÆðÐÞÊαäÁ¿»òº¯Êýʱ£¬ÈçÔÚÍ·ÎļþÖÐ: extern int g_Int; ËüµÄ×÷ÓþÍÊÇÉùÃ÷º¯Êý»òÈ«¾Ö±äÁ¿µÄ×÷Ó÷¶Î§µÄ¹Ø¼ü×Ö£¬ÆäÉùÃ÷µÄº¯ÊýºÍ±äÁ¿¿ÉÒÔÔÚ±¾Ä£¿é»îÆäËûÄ£¿éÖÐʹÓ㬼ÇסËüÊÇÒ»¸öÉùÃ÷²»ÊǶ¨Òå!Ò²¾ÍÊÇ˵BÄ£¿é(±àÒëµ¥Ôª)ÒªÊÇÒýÓÃÄ£¿é(±àÒëµ¥
Ïà¹ØÎĵµ£º
http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html
Sunday, May 10, 2009
Hadoop should target C++/LLVM, not Java (because of watts)
< type="text/javascript">
digg_url="http://www.trendcaller.com/2009/05/hadoop-should-target-cllvm-not-java.html";
Over the years, ......
ÔÚʹÓûص÷º¯ÊýÖУ¬ÍùÍù»áÉèÖÃÒ»¸öÖ¸Ïòº¯ÊýµÄÖ¸Õ룬ÄÇΪʲô²»Ö±½Ó½«º¯ÊýÃû×÷Ϊ²ÎÊý´«µÝÄØ£¿
ÔÒòÊÇ£ºÔÚCÓïÑÔÖк¯Êý±¾Éí²»ÊDZäÁ¿£¬µ«ÊÇ¿ÉÒÔ¶¨ÒåÖ¸Ïòº¯ÊýµÄÖ¸Õë¡£ÕâÖÖÀàÐ͵ÄÖ¸Õë¿ÉÒÔ±»¸³Öµ¡¢´æ·ÅÔÚÊý×éÖС¢´«µÝ¸øº¯ÊýÒÔ¼°×÷Ϊº¯ÊýµÄ·µ»ØÖµ£¬
ÏÂÃæÊÇÎÒÔÚÍøÉÏÕÒµ½µÄÒ»¸ö¹ØÓڻص÷º¯ÊýµÄСÀý×Ó£¨¶ÔÔÎĵÄÀý×ÓÓÐËùÐ޸ģ©
ÔÎÄÁ ......
jjhou.csdn.netÀïÃæÓÐ
--------------------------------------------------------------------------------
ÔÚ console mode ÖÐʹÓà C/C++ ±àÒëÆ÷
ºî½Ý 1999.04.08
......
CÓïÑÔÖУ¬Í¼Ðκ¯Êý´óÖ¿ɷÖΪÁ½Àࣺ×Ö·ûģʽº¯ÊýºÍͼÐÎģʽº¯Êý¡£±¾½ÚÎÒÃÇÁ·Ï°Ê¹ÓÃ×Ö·ûģʽº¯Êý¡£
ʹÓÃ×Ö·ûģʽº¯ÊýÓ¦¸ÃÔÚ³ÌÐòÖÐÁªÈëconio.hÍ·²¿Îļþ¡£
ÏÂÃæÊÇһЩº¯ÊýµÄ×÷ÓÃ
1) void &nbs ......