How can I link two or more .cpp files.
What is the difference between linking .cpp with another .cpp and linking .cpp with .h?
I don't know how to link .h too :).
If you are using IDE, there is usually an option to add or exclude your files from compiling and linking from project/solution.
For example in Code::Blocks you will see that window after right-clicking on cpp file and selectinf properties: http://puu.sh/8OpSr.png
If you are launching compiler from command line, look at the compiler documentation. It should be easy to find.
You should notlink .h files because thay should not have any actual code at all. However if you want there is nothing preventing you.
Linking is a explicit operation that combines multiple object files into an executable.
If you're using an IDE, the IDE should automatically add any .obj files to the link step. If you're using the command line to compile, then you have to manually invoke the linker with the correct set of input files.
.h files do not produce .obj files, so they have nothing to do with linking.
Is there anything I must write more than my code in every .cpp file?