Learning Visual C++ 2012

Started by
4 comments, last by ZachHoefler 10 years, 7 months ago

So I'm a computer science major learning in C++, but my school doesn't teach us using Visual Studio. I know how to do a lot of the basics of programming, so instead I'm looking more for how to do advanced stuff with Visual Studio.

Namely how to deal with adding my own libraries to a project and getting them to work, or more generally anything involving the Project Properties window. Do you guys know anywhere that can teach me how to do that?

Advertisement

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.

visualnovelty.com - Novelty - Visual novel maker

You can add the include headers and library path to the VC++ Directories tab in the solution configuration, that way you dont have to provide fulll path to any of the inluded headers or library files.

Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

Youtube videos are awesome to learn too if you are looking for quick conceptual understanding.

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?

You can add the include headers and library path to the VC++ Directories tab in the solution configuration, that way you dont have to provide fulll path to any of the inluded headers or library files.

I like that idea. Do I just edit the library directories field in there? Just out of curiousity, what's the Library WinRT Directories?

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.

This topic is closed to new replies.

Advertisement