Creep2DJ Creep2DJ - 6 months ago 22
C++ Question

If I #include a header file in a non-main source file, do I need to also do that in the main file?

I have a file

, in which
is #included. Do I need to include in
as well? Or may I leave it alone?


You need to add #include <algorithm> to main.cpp if main.cpp uses any functions or classes, or anything else that's defined in <algorithm>.

What some other translation unit uses is irrelevant.