????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();
}
}