Adding API library for a project?

Hello all,

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?

thanks in advanced.
I'd like to say SDK is equal to API (Feel free everyone to say it's not), but actually:

An include file is a text file which defines how call to functions are made.

An library file is a compiled binary file which defines where in a DLL the function is, or, if it is a static library file, it defines where in itself the function is.

An bin file is, in the case of a dynamic library file, where the DLL is, but you will never worry about that, you should just make sure the DLL is in the working directory of the executable.

VC++ only recognizes the header if it is in one of the inclusions paths specified by the user or by default, all other paths aren't looked up for obvious speed reasons.

Using a library, most times you only need to configure Include and Lib folders to match those written in the library's documentation (or just look up for an 'include' and 'lib' folder in the sdk/api)
I'd like to say SDK is equal to API (Feel free everyone to say it's not), but actually:

An SDK might include API's, frameworks, libraries, utilities, compilers, profilers, example programs, pre-setup projects for IDE's, etc.
Last edited on
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.
closed account (3qX21hU5)
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.

Advanced2D.lib
d3d9.lib
d3dx9.lib
dxguid.lib
winmm.lib

and so on.

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.
Last edited on
Thank guys so much.
Topic archived. No new replies allowed.