   Header, resource, and source files
  I have most of my programming experience in the Java platform, so I don't understand how a header file should be used or what it does. I'd like an example that demonstrates it compared to a source file. Secondly, what is a resource file?   
  Header and source files help separate symbol definitions from their declarations.  Declarations for symbols are typically declared in the header files, while their definitions can be defined in either object files (compiled source files), library files (*.lib, *.o), or dynamic-link library files (*.dll, *.a).  Note that #include'ing a header file copies that header file and pastes it into the source file.  Read more about organizing code files in C and C++.Here's a (lame) example:// var.hextern int var;// The "declaration" for the symbol "var" (There exists somewhere an integer named "var")// var.cpp#include "var"// From including this header file, var.cpp knows that there exists somewhere an integer named "var"int var = 0;// The "definition" for the symbol "var" (here exists an integer named "var")// test1.hvoid test1();// The "declaration" for the symbol test1 (there exists somwhere a function named "test1")// test1.cpp#include "test1.h"// From including this header file, test1.cpp knows that there exists somewhere a function named "test1"#include "var.h"// From including this header file, test1.cpp knows that there exists somewhere an integer named "var"void test1() {// The "definition" for test1 (here exists a function named "test1")++ var;// test1.cpp does not know where the symbol "var" is located, but it knows its an integer, so we can perform integer operations on it}// test2.hvoid test2();// test2.cpp// In this sample, we mimic the compiler process, and copy-paste our include files inside our source file:extern int var;// There exists somewhere an integer named "var" (compare to:  #include "var.h")void test2();// There exists somewhere a function named "test2" (compre to:  #include "test2.h")// Also note that if we change var.h, or test2.h, we also have to mirror the changes here!extern int var2;// There exists somewhere an integer named "var2" (bogus symbol, but for demonstration)#include <iostream>// From including this header file, test2.cpp knows that there exists somewhere a stream named "cout" (among other things)void test2() {// test2.cpp does not know where the symbol "var" is located, but it knows that it is an integer, so we can perform integer operations on itvar += 5;// test2.cpp does not know where the symbol "std::cout" is located, but it knows that it is a stream, so we can perform stream-like operations on itstd::cout << "var is now " << var;// The following line will compile, but its symbol isn't defined anywhere in our project, and will give an error at link-time:// var2 = 5;}// main.cpp#include "test1.h"// From including this header file, main.cpp knows that there exists somewhere a function named "test1"#include "test2.h"// From including this header file, main.cpp knows that there exists somewhere a function named "test2"int main() {test1();// main.cpp does not know where the symbol "test1" is located, but it knows its a function, so we can perform function-like operations on ittest2();// main.cpp does not know where the symbol "test2" is located, but it knows its a function, so we can perform function-like operations on it// at this point, "var is now 6" is printed// ++var; // <<-- whoops!  main.cpp does not know that "var" exists, nor does it know what type "var" is.// #include "var.h" at the top of this file to fix, or write "extern int var;" at the top of this file// also note that main.cpp doesn't even have to know that "var" even exists// nor does main.cpp know that test2() calls on std::cout!// nor does main.cpp have to even know about std::cout!}The magic happens during the linking stage.  After the source files are compiled into their immediate forms, object files, which provide the symbol definitions that the each source comes across:var.cpp provides definitions for the symbols:  vartest1.cpp provides definitions for the symbols: test1, but needs the definitions for the symbols:  vartest2.cpp provides the definitions for the symbols:  test2, but needs the definitions for the symbols:  var, std::cout (and var2, if you uncomment out the line: "var2=5")main.cpp provides the definitions for the symbols:  main, but needs the definitions for the symbols:  test1, test2The linker then hooks the needed symbols from the different sources together, and produces the final product (executable, library file, or dynamic library file).   Thus test1(), and test2() refer to "var", the integer defined in var.cpp.  If we have the line "var2=5" uncommented, the linker will complain that it was unable to find the symbol definition for "var2" that test2.cpp is referring to.  Also note that we didn't provide a symbol for std::cout, or its operations.  This is where the libraries step in.  The linker will search additional libraries for the missing definitions (std::cout, and etc) from the libraries you supply to your linker (or from libraries specified by the default compiler settings).Indeed, the compiling process vastly differs from Java's, where everything *just works* across files, whereas, in C/C++, the programmer is required to be more explicit.Quote:Secondly, what is a resource file?A resource file, at least in Windows, is a file in which packs external resources, such as the resource script (win32 forms, dialogs, buttons, images, menus, etc) or other custom data, either externally (in a .rc file that exists by the side of the .exe, or inside the .exe.Hope this helps!  [smile][Edited by - _fastcall on May 29, 2010 1:28:05 AM]