C++??extern????????
???????????? ???????[ 2015/8/21 13:45:42 ] ??????????????????? ????????
????chapter1????λ?????C?????C++
???????????????У?C++?л????C???????д??????????????????????д?ú???????
????http://blog.csdn.net/keensword/article/details/401114
??????????????????????????devVar.c???????????extern.cpp????????extern???????????devVar.c????ж??????????????
????devVar.c?????????????????
????#include <stdio.h>
????int i = 1;
????void func()
????{
????printf("%d"??i++);
????}
????extern.cpp????д????????????
#include "stdafx.h"
#include <stdio.h>
#include <iostream>
using namespace std;
//#include "devVar.h"
//extern int i;
//extern void func();
extern "C"
{
extern int i;
extern void func();
//#include "devVar.h"
}
int main(void)
{
for (int x = 0;x < 10; x++)
{
func();
}
}
??????????C++????б???C?????????extern "C"???????????????????
????extern "C"
????{
????????C????????????
????}
????????????
??????devVar.h????????C??????devVar.h???C??????????????.cpp????а???C??????????
????devVar.h???????????
????#include <stdio.h>
????int i = 1;
????void func()
????{
????printf("%d"??i++);
????}
????extern.cpp??????????????
#include "stdafx.h"
#include <stdio.h>
#include <iostream>
using namespace std;
//#include "devVar.h"
//extern int i;
//extern void func();
extern "C"
{
//extern int i;
//extern void func();
#include "devVar.h"
}
int main(void)
{
for (int x = 0;x < 10; x++)
{
func();
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11