.c vs .cc vs. .cpp vs .hpp vs .h vs .cxx [duplicate]

Possible Duplicates:
*.h or *.hpp for your class definitions
Correct C++ code file extension? .cc vs .cpp

I used to think that it used to be that:

  • .h files are header files for C and C++, and usually only contain declarations.
  • .c files are C source code.
  • .cpp files are C++ source code (which can also be C source code).

then files like .hpp, .cc, and .cxx came along, and I got totally confused… what’s the difference(s) between those? When do you use the “new” ones?

6 Answers
6

Leave a Comment