Jump to content

  • Log In with Google      Sign In   
  • Create Account


ZachHoefler

Member Since 30 Aug 2013
Offline Last Active Oct 06 2013 06:27 PM
-----

#5090332 Learning Visual C++ 2012

Posted by ZachHoefler on 30 August 2013 - 02:54 AM

It's only a rather small portion of the book, but the part of Game Coding Complete goes through a bit of project setup before diving into coding (see the start of Ch4). It sets up external libraries, changes output directories for a cleaner solution directory, etc.

 

 

To include a static library to an existing project you need to do the following:
* Add the include path(s) to the library's headers.
* Add the library path to the library itself.

These are done in the project configuration tab.
* Add the library ("foo.lib") to the "Linker - Additional libraries" box

This should in theory be it, but you may run into linker errors if:
* The library in question requires other libraries to be included.
* The library was built in a different configuration than your project (I think this is Windows-only. /MDd or /MD flags needs to be same for both)

There are probably other considerations to be made, that other posters can supply.

 

So if I were to add foo.lib to my project using that, would I need to move the library to somewhere special? Or could I just do the full path to foo.lib?

It just has to be in one of the library directories you specified in the previous step. Not sure how VS handles two files with the same name in different directories, though.

 

If you want an example of someone including libraries/directories/etc, you could look up an example of including DirectX in a version of VS pre-2012. A quick Google search gives this example.




PARTNERS