extern "C"ÎÊÌâ
/*-----------c.h--------------*/ #ifndef _C_H_ #define _C_H_ extern "C" int add(int x, int y); #endif /*-----------c.c--------------*/ int add(int x, int y){ return x+y; } /*-----------cpp.cpp--------------*/ #include "c.h" void main() { add(1, 0); } ÕâÈý¸öÎļþ·ÅÔÚͬһĿ¼Ï£¬ÓÃVC6´ò¿ªcpp.cppÎļþ±àÒë³É¹¦£¬ÔËÐÐʧ°Ü£¬ÎªÊ²Ã´£¿Ôõô¸Ä£¿
/*-----------c.cpp--------------*/ int add(int x, int y){ return x+y; } ÒýÓà /*-----------c.cpp--------------*/ int add(int x, int y){ return x+y; } ûÓ𡣬×îºÃ²»¸ÃÎļþÃû extern C±íÃ÷ÒÔCµ÷Ó÷½Ê½Ö´ÐУ¬Äã±¾Éí¾ÍÊÇC´úÂ룬¼ÓÕâ¸ö¸Éʲô£¿ ºÃÏñÒª¼ÓÒ²ÒªÔÚcppÀïÃæ¼Ó C/C++ code: /*-----------c.h--------------*/ extern int add(int x, int y); /*-----------c.c--------------*/ int add(int x, int y){ return x+y; } /*-----------cpp.cpp--------------*/ #include "c.h" int main() { add(1, 0); return 0; } ÊÔÊÔ C/C++ code: /*-----------c.h--------------*/ #ifndef _C_H_ #define _
Ïà¹ØÎÊ´ð£º
fastshow() { FILE *fp; char name[10]; char ch[512]; printf("ÇëÊäÈë´ýÏÔʾµÄÎļþÃû\n"); scanf("%s",name); if((fp=fopen(name,"r"))==NULL) { printf ......
FILE *pFile; errno_t m_err; m_err = fopen_s(&pFile,"1.txt","r"); char ch[100]; memset(ch,0,100); fread(ch,1,100,pFile); MessageBox(ch); fclose(pFil ......
ÎÊÌâÃèÊö£º ÓÐÒ»¼òµ¥µÄC³ÌÐò£¬ÈçÏ£º void foo ( ) { int i ; p r i n t f ( "%d " , i ++); } int main ( ){ int j ; for ( j = 0 ; j < 1 0 ; ++j ) foo ( ) ; } º¯ ......
1001.exe ÖÐµÄ 0x0041394f ´¦Î´´¦ÀíµÄÒì³£: 0xC0000005: дÈëλÖà 0x66792e62 ʱ·¢Éú·ÃÎʳåÍ» ÕâÊÇÔõô»ØÊ£¿Ð»Ð»ÁË£¬ÎÒÊDzËÄñ ËÖªµÀÔõô»ØÊ¡¡ÕâÊǸöͨÓõĴíÎóÌáʾ¡¡ÉÏ´úÂë ÐèÒªÖØÐ½øÐбàÒë Ò ......
É¢·Ö£¬ÎªC£¯C++ÂÛ̳Ôö¼ÓµãÈËÆø£¡£¡ jf jf£¬Â¥Ï±£³Ö¶ÓÐÎ Ö»¼û¹ý²»¸ÒÉ¢·ÖµÄ£¬Ã»¼û¹ý²»¸Ò½Ó·ÖµÄ ½Ó ǰÅÅÁôÃû jf ÕâÀïÈËÆø»¹²»´í°¡£¡ ½Ó·Ö ¡¡ C/C++ºÃÈÈÄÖ¶î¡¡ÆäËû°æ¿é¾ÍÏà¶ÔûÕâôÈÈÁË
......