main file: main.cpp
#include "file.h" #include <iostream> using namespace std; int main(int argc, char* argv[]){ func1(); return 0; }; header file: file.h
void func1(); file.cpp file with file.h code
#include <iostream> void func1(){ std::cout << "1"; }; so when you try to compile the code using the command (g ++ main.cpp), display a message that you don’t know what the func1 () function is, but when using (g ++ main.cpp file.cpp) everything works, so the doubt has crept in so compile, because if later in the files will be from 10 and all of them need to be registered after (g ++ main.cpp ...)? I use MinGW version gcc-6.3.0