#include -ing a *.cpp file

Hello there,

This is my first post here. Hope it is not a very dumb question.
Just wanted to understand does anything different happen and CAN WE actually do a #include *cpp file rather than a *.h file.

Thanks in advance.
You can #include any file.
But you shouldn't #include cpp files. cpp files are meant to be compiled and linked, for the same reason you shouldn't pass a header to the compiler
for the same reason you shouldn't pass a header to the compiler
Well, that's perfectly safe. The compiler will just ignore non-source files (i.e. files other than *.cpp, *.cxx, *.C, etc.).
Hey Bazzy and Helios,

Thanks both. I hope I get really smart in C++ soon :) and return the help to the forum.
I might be posting quite a few questions in the near future.

Regards,
Ash
Last edited on
Topic archived. No new replies allowed.