There are no strict rules AFAIK, but there are de-facto standard. That is:
- c source files: c
- c header files: h
- c++ source files: cpp, cc, cxx
- c++ header files: h, hh, hpp
at least for the most common. I won't use the c extension for a cpp
program, because many compilers that compile both c and c++ interpret
the file as a c source if it has the c extension. For the header files
there is any problem indeed because the keep the context of the
translation unit in which they are included.
Historically, the original suffix for C++ was .C. Which, of
course, poses problems on systems which don't distinguish case
in filenames (most of them, I think---at least, I've never
encountered any but Unix which do distinguish case). For
whatever reasons, the convention seems to have become
established of using .cpp in the Windows world, whereas .cc
seems more frequent (but not exclusive) under Unix.
All of the compilers I know will treat either as a C++ source in
their most recent incarnations, and all have always had an
option to force treating the source as C++. Just be consistent,
and don't worry about it.
The conventions for header files are even vaguer. The original
convention was just to use .h, and not distinguish them from C
header files. Apparently, I wasn't the only one who didn't like
this, and a lot of people adopted different rules: .H, .hpp or
..hh. Again, just be consistent (although I do think it better
to restrict .h to headers which can be used within a C program
as well).