You must use a tool called a “header”. In a header you declare the function that you want to use. Then you include it in both files. A header is a separate file included using the #include
directive. Then you may call the other function.
other.h
void MyFunc();
main.cpp
#include "other.h"
int main() {
MyFunc();
}
other.cpp
#include "other.h"
#include <iostream>
void MyFunc() {
std::cout << "Ohai from another .cpp file!";
std::cin.get();
}