// c.h头文件
#ifndef C_H
#define C_H
#ifdef __cplusplus
extern "C" {
#endif
void print(int i);
#ifdef __cplusplus
}
#endif
#endif
// c.cpp 源文件
#include "c.h"
#include<iostream>
void print(int i) {
std::cout << i << std::endl;
}
// main.cpp
extern "C" void print(int i);
int main() {
print(1);
return 0;
}