You should make header file for source files you would like to use in your code. Therefore it is unlikely - not impossible - you have to make a main.h header, since in both car.cpp and speed.cpp you probably don't include functions that you have declared in main.cpp. In contrast you might include functionality of car.cpp and speed.cpp in in main.cpp and therefor you would like to include their headers in your mainfile.