I am running two different programs (main.cpp with header.h and number.cpp) and calling them together in one other final program. I have no linking problem and include the header and source code. But I want to call main.cpp in number.cpp when I do that with only including main.cpp and calling the function from main.cpp it runs the whole program of main.cpp which is the one with the int main function. The other one doesnt have an int main func. I don't think both of them can have a int main function because that will give errors. Can you explain to me why only the main.cpp is running and not both, because all I want do do is have number.cpp to run first then call the function in main.cpp. What can I do to do this. if I dont include main.cpp and simply call the functions I get linking error so I decided to just include the main.cpp file and it runs but only the main.cpp code compile.