Functions declarations in header file

image
image


I think I did exactly as the instructions:

But, when I try to compile the ‘test.cpp’ file, it reports that the function is not declared. Besides, I’ve tried to write both of the definition and the declaration part in the ‘functions.h’ file, it will run successfully!

Hi,

Can you link the exercise?

Your code should work if you compile g++ functions.cpp test.cpp.
Only using test.cpp should throw an error (since test.cpp only know about functions.h).

Yes, I get it. I just did as the cheatsheet say, in fact the course has a clear instruction on how to link the two cpp files. Thanks for replying!