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

"extern C", ÄãÕæµÄ¶®ÁËÂð£¿

       ÔÚc++ primeÊéÖп´µ½¹ý£¬ÔÚDLLºÍlibÖп´µ½¹ý£¬µ«ÊÇÿ´Î¿´¹ý¾Í²»ÇóÉõ½âµØһɨ¶ø¹ý¡£ÐÄÀïÖªµÀÓÐextern cÕâ¸öÓï¾ä£¬È´²»ÖªµÀ¸ÃÓÃÔÚÄÄÀÓÖÄÜÆðµ½Ê²Ã´×÷Óᣰ¦£¬ÏëÏë×Ô¼ºÒ²ËãÊÇд¹ý²»ÉÙCODEµÄÈËÁË£¬¿ÉÕâÖÖÑÛ¸ßÊֵ͵Ä벡ȴ´Óû¸Ä±ä¹ý¡£½ñÌìͻȻÏëÆðexternÕâ¸ö¹Ø¼ü×Ö£¬Ëì¾ö¶¨²»ÄÜÔÙÕâôÀË·Ñʱ¼äÁË¡£¿ª¶¯google£¬ÈËÈâÁËÒ»°ÑexternÕâС×Ó£¬ÒªËµËÑË÷ÒýÇæÕæÊǸöºÃ¶«Î÷£¬Ê²Ã´¶¼ÌÓ²»¹ýÈ˼ҵÄÑÛ¾¦¡£
      ½ñÌì¾ÍÔÚÕâÀï°ÑexternÕâÀÏС×Ó¸ø˵Ã÷°×ÁË£¬Ò²ËãÓиö°×Ö½ºÚ×Ö°É¡£
      Ê×ÏÈ£¬ÄãÒª¸ãÃ÷°×£¬externÊÇC++µÄ¹Ø¼ü×Ö¡£ÄÇôΪʲôC++»áÓÐÕâ¸ö¹Ø¼ü×ÖÄØ£¿
      ¸÷λ¿´¹ÙÓ¦¸ÃÖªµÀ£¬C++¶ÔÏàͬº¯ÊýÃû£¬µ«ÊDz»Í¬º¯Êý²ÎÊýµÄº¯ÊýÓÐÖØÔØÕâ¸ö¹¦ÄÜ°É£¬bingo! hey man, you got the key! ¶ÔÁË£¬C++±àÒëÆ÷»áÔÚ±àÒëʱ°ÑÖØÔصĺ¯ÊýµÄº¯ÊýÃûÐÞ¸ÄΪ²»Í¬µÄº¯ÊýÃû£¬Õâ¾ÍÊÇΪɶC++Äܹ»½øÐÐÖØÔصÄÔ­Òò¡£¾Ù¸öÀý×Ó°É¡£
       int a(char)
int a(int)
int a(double)...
       ÖªµÀ±àÒëºó£¬ÕâЩº¯Êýa»á±ä³ÉʲôÂð£¿ÎÒÒ²²»ÖªµÀ£¬Ó¦¸Ã²»Í¬µÄC++±àÒëÆ÷Óв»Í¬µÄʵÏÖ·½Ê½£¬ÓпÉÄÜ»áÊÇÕâÑùµÄÑù×Ó£ºa_char_xxx,a_in_xxx,a_double_xxx¡£ÕâÊÇÔ­Àí£¬¸÷λÓÐÒÉÎʵģ¬ÎÒÒ²¾ÍÖ»ÄܽâÊ͵½Õâ¸öµØ²½ÁË£¬¸ü½øÒ»²½µØÀí½â£¬¿´¹ÙÃÇ¿ÉÒԲο¼ºî½Ý´óÉñ·­ÒëµÄ¡¶ÉîÈë̽¾¿C++¶ÔÏóÄ£ÐÍ¡·£¬ÀïÃæÓиüÏêϸµÄ³ÂÊö¡£ 
       ÒÔÉÏÊÇ´æÔÚexternÕâ¸ö¹Ø¼ü×ÖµÄÔ­Òò¡£µ«ÊÇ´æÔÚexternÕâ¸ö¹Ø¼ü×ÖµÄ×÷ÓÃÓÐÄÄЩÄØ£¿
       ºÜ¼òµ¥À²£¬"extern c"µÄ×÷ÓþÍÊǸæËßC++±àÒëÆ÷²»ÒªÔÙ¸øÎҸı亯ÊýÃûÁË£¬ÎÒ¾ÍÒªÔ­ÑùµÄº¯ÊýÃû£¬Ð»Ð»¡£
       »¹ÊÇÉÏÃæµÄÀý×Ó£º
       extern "c"
{
int a(char);
}
       ÕâÑù£¬C++±àÒëÆ÷¾Í»á×𾴵ػشðÄ㣬“ºÃµÄ£¬Ö÷ÈË£¬ÌýÄãµÄ”¡£±àÒëºóµÄ·ûºÅ»¹ÊÇa£¬¶ø²»ÊÇa_char_xxxµÈµÈ¡£
       ÄÇôÕâ¸öʱºò£¬Äã¿ÉÄÜ»áÎÊ£¬ÎÒÖªµÀÁË£¬¿ÉÊÇÕâÑù×öÓÐʲôÓÃÄØ£¿¾ÍÊDz»¼Óextern£¬ÎÒ»¹ÊÇÄܱàÒëͨ¹ý°¡£¬ÎÒ»¹ÊÇÄÜÕý³£Ö´Ðа¡¡£Ã»´í£¬ÕâЩÄ㶼ÄÜ×öµ½£¬µ«ÊÇ£¬µ±ÕâЩº¯Êý±»·â×°ÔÚÒ»¸ö¿âÀïÄØ£¿¶ø


Ïà¹ØÎĵµ£º

C/C++ ³ÌÐòÉè¼ÆԱӦƸ³£¼ûÃæÊÔÊÔÌâÉîÈëÆÊÎö

1.ÒýÑÔ
¡¡¡¡±¾ÎĵÄд×÷Ä¿µÄ²¢²»ÔÚÓÚÌṩC/C++³ÌÐòÔ±ÇóÖ°ÃæÊÔÖ¸µ¼£¬¶øÖ¼ÔÚ´Ó¼¼ÊõÉÏ·ÖÎöÃæÊÔÌâµÄÄÚº­¡£ÎÄÖеĴó¶àÊýÃæÊÔÌâÀ´×Ô¸÷´óÂÛ̳£¬²¿·ÖÊÔÌâ½â´ðÒ²²Î¿¼ÁËÍøÓѵÄÒâ¼û¡£
¡¡¡¡Ðí¶àÃæÊÔÌâ¿´ËƼòµ¥£¬È´ÐèÒªÉîºñµÄ»ù±¾¹¦²ÅÄܸø³öÍêÃÀµÄ½â´ð¡£ÆóÒµÒªÇóÃæÊÔÕßдһ¸ö×î¼òµ¥µÄstrcpyº¯Êý¶¼¿É¿´³öÃæÊÔÕßÔÚ¼¼ÊõÉϾ¿¾¹´ïµ½ÁËÔõÑùµÄ ......

ACM cº¯Êý´óÈ«

º¯ÊýÃû: abs ¹¦  ÄÜ: ÇóÕûÊýµÄ¾ø¶ÔÖµ
Óà ·¨: int abs(int i);
³ÌÐòÀý:
#include <stdio.h>
#include <math.h>
int main(void)
{
  int number = -1234;
  printf("number: %d  absolute value: %d\n", number, abs(number));
  return 0;
}
º¯ÊýÃû: atof
¹¦  ......

C/C++¿ª·¢¾­ÑéÈ˲ÅÇë½ø£¡

ÉÏÖÜÀÏ°å·ÖÏÂÀ´6¸öְλÈí¼þ¿ª·¢·½ÃæµÄְλ¸øÎÒ£¬ÒªÎÒ°´Ö°Î»ÒªÇóÑ°ÕÒºÏÊʵÄÈ˲š£¾ÓÈ»ÊÇC/C++!¾ÝÎÒËùÖª£¬ÔÚÈ˲ſâÖУ¬JAVA È˲ŵ¹ÊÇÓ¦Óо¡ÓУ¬Ñ§CµÄ£¬»¹ÊÇǶÈëʽ¿ª·¢µÄ¿ÉÕæµÄºÃÉÙ°¡¡£ÎÒÓÖ²»ÊÇŮ洣¬ÄѵÀÎÒ»áÔìÈ˲Åô£¿ÒªÇóÌõ¼þ»¹Õâô¸ß£¡
ÒÔÏÂÊÇ´óÁ¬Èí¼þÔ°¼¸¼ÒÖªÃûÍâÆóίÍÐÎÒÃÇÕÐƸµÄְλÐÅÏ¢¡£
Position 1 Èí¼þ¿ª·¢¹¤³Ìʦ ......

PRO*C±à³ÌÖгöÏֵĴíÎó

°²×°ÍêOracleºó£¬Ê¹ÓÃPRO*C±àÒë.pcÎļþ£¬³öÏÖÒÔÏ´íÎó
proc: error while loading shared libraries: libclntsh.so.11.1:
cannot open shared object file: No such file or directory
½â¾ö·½·¨£º
ÔÚ/etc/profileÖÐÌí¼Ó
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:/usr/local/lib;
export LD_LIBRARY_PATH
È»ºó¿ÉÒÔ ......

¡¶the c programming language¡·»Ø¹ËÖ®Ò»

1,³ÌÐò¿ØÖÆÖеĿØÖÆÁ÷Óï¾äÓÃÓÚ¿ØÖƸ÷¼ÆËã»ú²Ù×÷Ö´ÐеĴÎÐò¡£
 Ê²Ã´ÊÇ¿ØÖÆÁ÷Óï¾äÏëÁË°ëÌ죬ԭÀ´²»¹ýÊÇÕâЩ£¬if-elseÓï¾ä£¬else-ifÓï¾ä£¬switchÓï¾ä£¬whileÑ­»·£¬forÑ­»·£¬do-whileÑ­»·µÈ¡£
2,»¨À¨ºÅ{}£¬ÆäÖеÄÓÒ»¨À¨ºÅÓÃÓÚ½áÊø³ÌÐò¿é£¬Æäºó²»ÐèÒª·ÖºÅ¡£
  µ±³õÒ»¿´µ½“Æäºó²»ÐèÒª·ÖºÅµÄ”ʱºòÏëÁË°ëÌ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ