extern C浅析
extern C浅析
//c++中想调用c语言函数
xxx.h
#pragma once
#ifdef __cplusplus //两个_下划线
extern "C" {
#endif // !__cplusplus //两个_下划线
#include <stdio.h>
void show();
#ifdef __cplusplus
}
#endif // !__cplusplus
xxx.h
#include "xxxx.h"
void show()
{}
main.cpp
#include xxx.h
void fun()
{
show();
}
浙公网安备 33010602011771号