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

posted on 2021-04-22 10:45  lodger47  阅读(39)  评论(0)    收藏  举报

导航