I'm not sure how to ask this question. I like understanding c++ via real applications. Some libraries for example OpenCV, I have to add its header files to let compiler recognize them. My question is I wanna know how does the compiler in VC++ recognize the header files and what does lib and bin files mean? How can I put them in my project file or in the proper place? Is there any tutorial or book explain the idea in general? What is the difference between SDK and API?
I'm not sure how to ask this question. I like understanding c++ via real applications. Some libraries for example OpenCV, I have to add its header files to let compiler recognize them. My question is I wanna know how does the compiler in VC++ recognize the header files and what does lib and bin files mean? How can I put them in my project file or in the proper place?
A header file contains source code. When you #include a header file, the pre-processor will literally paste the contents of that file where the pre-processor directive to include it were. This happens before compilation and the compiler doesn't really even know it happened. You do have to specify where the header file is located in order for the pre-processor to do this. In VC++, you go into project settings and find a field called additional include directories or something like that. You have to add in the path to the header files you want to include.
To link to a library, you need to go somewhere in project settings and find the place where you add the library you want to link to. There you will add something.lib. Then you need to find, in project settings, the field where you include the path to the libraries you want to link to.
In VC++ 2010 and newer (I think) you can find the settings iseeplusplus mentioned here.
For adding where to search for include files - Go to project -> Project Settings -> Configuration Properties -> C/C++ -> General. You will see on the right a field that says additional include directories. You can add where to search for include files here.
For adding where to search for library files you should do this -> Open up project settings again and go to VC++ Directories -> off to the right you will see where to add your library destinations. Type in where you library files are located or browse to them.
After that you will need to do this. Go to Linker -> Input -> Additional Dependicies off to the right -> Now type in all the library files you want to use for this project. Here is a example of what it might look like.
Just remember that all these settings are for that project only not for all projects.
I think everyone else answered most of your other questions but if you want more info on how libraries are created or a easier example to understand let me know and I can send you my current 2D game engine library I am working on that is pretty simple to understand.