question about multible source files
I have two files. One is main.cpp and one is testfunction.cpp. testfunction.cpp has void testfunction()... main.cpp has int main()...
If I want to use testfunction from main it brings an error that no such function exists. But I am sure that testfunction.cpp is also getting compiled because if I add an error there I will get an compile error.
The only solution I found was to use main.h, main.cpp + testfunction.h and testfunction.cpp. All includes I need for main.cpp are included in main.h. testfunction.cpp includes first testfunctin.h and testfunction.h is getting included by main.h.
I think this could be a bad way. Is it?
Any other way to use testfunction from main.cpp?