11智能在线
新记
c++中如何在主函数中调用其他文件内的函数
如题所述
举报该文章
其他看法
第1个回答 2018-06-09
extern声明一下
例
f1.cpp
int fun()
{
cout<<"fun";
return 0;
}
main.cpp
#include"f1.cpp"//包含
#include<iostream>
using namespace std;
int main()
{
extern int fun();//声明
fun();//调用
return 0;
}
本回答被网友采纳
相似回答
大家正在搜
相关问题
c++中如何在主函数中调用其他文件内的函数?
C++ 如何在主函数中调用另一个文件定义的函数文件中定义函数...
c++工程里一个文件怎么调用另外一个文件里的函数
如何在主函数中调用类中的成员函数调用
C++ 如何调用在另一个CPP文件中实例化的类的实例中的函数
C++工程中如何在一个文件中调用另一个文件中的变量
一个C++工程中不同文件之间的函数如何互相调用?
在C++中,将类放在cpp中,main函数在另外一个cpp中...