🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
[TOC] # 多文件联合编程 先写头文件.h结尾 ~~~ #pragma once #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #include<stdlib.h> extern int a1(int a, int b); ~~~ 然后在其他文件中 ~~~ #include "1头文件.h" int main() { int a = a1(1, 3); printf("%d\n", a); system("pause"); return EXIT_SUCCESS; } ~~~ 为了避免同一个文件被include多次,c/c++中有两种方式,一种是`#ifndef`方式,一种是`#pragrame once`方式 方法一,旧的程序 ![](https://box.kancloud.cn/6d4c92270320061590d0e84efb204956_310x173.png) 方法二 ~~~ `#pragrame once //声明语句 ~~~