I have a folder of mostly .h and .cpp files for the Marlin firmware (3D Printing) from here.
How do I compile that so I can upload it to my Arduino Mega with Ramps?
You need to open the .ino file. that is the project file for the Marlin Firmware. then upload that. Also do some research about the settings for Marlin. It isn't just plug and play, you have to enter some information about your individual stepper motors.
http://solidutopia.com/marlin-firmware-user-guide-basic/ - heres a guide for Marlin.
the cpp and h files are c++ files that are apart of the project. the Arduino IDE cannot open these individually. the .ino file is the project file that will allow you to open up the entire project and not just one portion of it.