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

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 _


Ïà¹ØÎÊ´ð£º

cµÄ×Ö·û´®ÎÊÌâ

fastshow()
{
FILE *fp;
char name[10];
char ch[512];
printf("ÇëÊäÈë´ýÏÔʾµÄÎļþÃû\n");
scanf("%s",name);
if((fp=fopen(name,"r"))==NULL)
{
printf ......

CÎļþ¶ÁдÎÊÌâ¡£

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³ÌÐòÎÊÌ⣬¸ßÊÖÇë½ø£¡

ÎÊÌâÃèÊö£º
ÓÐÒ»¼òµ¥µÄ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 ( ) ;
}

º¯ ......

ÇóÖúcµÄÎÊÌâ

1001.exe ÖÐµÄ 0x0041394f ´¦Î´´¦ÀíµÄÒì³£: 0xC0000005: дÈëλÖà 0x66792e62 ʱ·¢Éú·ÃÎʳåÍ»

ÕâÊÇÔõô»ØÊ£¿Ð»Ð»ÁË£¬ÎÒÊDzËÄñ
Ë­ÖªµÀÔõô»ØÊ¡­¡­ÕâÊǸöͨÓõĴíÎóÌáʾ¡­¡­ÉÏ´úÂë

ÐèÒªÖØÐ½øÐбàÒë

Ò ......

É¢·Ö£¬ÎªC£¯C++ÂÛ̳Ôö¼ÓµãÈËÆø£¡£¡

É¢·Ö£¬ÎªC£¯C++ÂÛ̳Ôö¼ÓµãÈËÆø£¡£¡
jf

jf£¬Â¥Ï±£³Ö¶ÓÐÎ

Ö»¼û¹ý²»¸ÒÉ¢·ÖµÄ£¬Ã»¼û¹ý²»¸Ò½Ó·ÖµÄ

½Ó



ǰÅÅÁôÃû

jf

ÕâÀïÈËÆø»¹²»´í°¡£¡

½Ó·Ö ¡­¡­ C/C++ºÃÈÈÄÖ¶î¡­¡­ÆäËû°æ¿é¾ÍÏà¶ÔûÕâôÈÈÁË ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ