What is the difference between
Code:
 void func();
and
Code:
static void func();
I have a Codeblocks project with two files, main.cpp and main2.cpp.

main.cpp
Code:
#include <iostream>
#include"main2.cpp"
using namespace std;
void fnc_in_main(){
    cout<<"This is fnc_in_main() in main.cpp"<<endl;
}
int main()
{
    cout << "This is main() in main.cpp" << endl;
    fnc_in_main();
    fnc_in_main2();
    return 0;
}
main2.cpp
Code:
#include <iostream>
using namespace std;
static void fnc_in_main2(){
    cout<<"This is fnc_in_main2() in main2.cpp"<<endl;
}
in main.cpp, if I don't write
Code:
#include"main2.cpp"
the compiler gives an error saying fnc_in_main2() is not defined

in main2.cpp, if I do not write
Code:
static void fnc_in_main2(){
the compiler says fnc_in_main2() has been declared multiple times and says the multiple declaration occurred in main2.cpp.

However, it says here that declaring a function static makes it visible only in the file in which the function was declared, but in my program it looks like making it static actually caused it to be visible in the other file main.cpp.

Could someone please give me any idea about static functions and working with multiple files? Also, I think static functions inside a class works differently right?
Again, I did the compiling from codeblocks in this case. If I have to compile multiple files in gcc from the command line, how would I give the command?

Thanks in advance