title: Converting a *.c/*.h project (compiled as C++) to *.cpp/*.hpp
body: <p>Question: what is the best way to convert a <em>.c/</em>.h based project (which is forcefully compiled as C++ via the makefiles) to a <em>.cpp/</em>.hpp based project?</p>
  
  <p>Obviously, this is a triple-step process. The first would be to rename everything with *.c at the end to *.cpp; the second would be to rename everything with *.h at the end to *.hpp. What I'm getting caught up on is the third step- somehow building a list of what the files /were/ named (ie, myfile.c), then iterating through every single affected file and replacing every instance of the old filename with the new (myfile.c -> myfile.cpp). Obviously this would have to be done so the source files can still find everything that they need.</p>
  
  <p>The source code in question consists of around 2700 individual source files.</p>
  
  <p>The reason why I'm doing this is mostly because I'm porting said software package to Mac OS X, and that involves Xcode. Things are getting bloody messy trying to keep track of precisely what is C, C++, and the associated headers for either (then overriding the compiler for C++ compilation). It would be much simpler if everything C++ was *.cpp (with the associated headers being *.hpp), since then I can just leave Xcode at the default compiler setting as per the file extension and everything should work without any fancy intervention on my end.</p>
  
  <p>I should probably also note that I know precisely what files need to be converted, because they already compile properly and in a sane fashion if I'm overriding Xcode to compile as C++. That's not a problem- my issue is trying to figure out how to batch rename everything then run through all the files and update the #includes.</p>
  
  <p>Thank you in advance!
  -Keven Tipping</p>