/*test.h*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
void show();
#ifdef __cplusplus
}
#endif
/*test.c*/
#include "test.h"
void show()
{
printf("hello world\n");
}
/*extern浅析.c*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include "test.h"
using namespace std;
//如果想在C++中调用C函数 可以加如下声明
//extern "C" void show();//show函数按照C语言方式做链接
//或者在.h文件加声明
int main()
{
show(); //在C++中,函数可以发生重载,编译器会把函数名改变,C语言中不会发生,故会无法链接到原函数
system("pause");
return EXIT_SUCCESS;
}