C語言定義外部全局函數,只需要在定義當前函數的頭文件,多加如下聲明,就可以在外部文件調用該函數。
#ifdef __cplusplus
extern "C"{
#endif
int test();//定義全局函數
#ifdef __cplusplus
}
#endif
參考內容:
https://github.com/mregmi/ext2read(參考:lvm.h頭文件中extern "C"用法)
C語言定義外部全局函數,只需要在定義當前函數的頭文件,多加如下聲明,就可以在外部文件調用該函數。
#ifdef __cplusplus
extern "C"{
#endif
int test();//定義全局函數
#ifdef __cplusplus
}
#endif
參考內容:
https://github.com/mregmi/ext2read(參考:lvm.h頭文件中extern "C"用法)