??????????????????????C++??????????????????????????£?
????1??????????????????????????????????
????2??extern "C"??????
????3????????????????????
????4????????????????????????
?????????????Щ??????????????????У????????????????????????????????????“??????”??????????????漬?????????????б???????
????C/C++????????????
?????????“????”??????????????????????????.h??.c??.cpp??????????????????????????????????C/C++????????????????????????C/C++?????????ó???????????---???????---????(д??????????????????)??
????????????????????????????????????????????.c????.cpp????????????????????????????????????????????????tmp.cpp?????????.c????.cpp????????????????????(?????????.h?????????#include????)???????滻??????????????????
?????????????????????
????a.h
#ifndef A_H_
#define A_H_
static int a = 1;
void fun();
#endif
a.cpp
[cpp] view plaincopy
#include "a.h"
static void hello_world()
{
}
???????a.h??a.cpp?????????????????????????g++??-E???????a.cpp?????????????
????coderchen@coderchen:~/c++$ g++ -E a.cpp > tmp.cpp
??????tmp.cpp
# 1 "a.cpp"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "a.cpp"
# 1 "a.h" 1
static int a = 1;
void fun();
# 2 "a.cpp" 2
static void hello_world()
{
}
????tmp.cpp?????????????????????????????????????????????????????????????????????
????????#define A_H_?????????????????a.h????????????????????????????????????????????????????????
????????????????????????(cpp???)??????????????????????????????????????????????a.cpp??????????A_H_???????????a.cpp????η???#include "a.h"????????a.h???????滻??a.cpp???
??????????????tmp.cpp??????????????obj????????????????????????obj??????????????????????г???