none
Adding a Library to Visual Studio 2012

    Question

  • Hello,

    I am trying to use an SDK to work an actuator. The information says I have to add some libraries to be able to write a code for the project. The problem is I am following instructions for visual studio 2005, and I am using 2012. I have gotten as far as getting into the VC++ Directories but from there I do not know how to add a include more libraries. Help, please?

    Nicholas

    Friday, September 27, 2013 4:17 PM

Answers

  • Hello,

    I am trying to use an SDK to work an actuator. The information says I have to add some libraries to be able to write a code for the project. The problem is I am following instructions for visual studio 2005, and I am using 2012. I have gotten as far as getting into the VC++ Directories but from there I do not know how to add a include more libraries. Help, please?

    Nicholas

    [Assuming you are writing a native Visual C++ Win32 application.]

    Go to PROJECT > Properties

    Under Configuration drop down, choose All Configurations.

    Configuration Properties > Linker > Input > Additional Dependencies.  Click the drop-down arrow menu at the right of the field and choose Edit.  Then type in the name of the .lib file you want to link into your program. (It might be something like ActuatorSDK.lib.  Maybe installed in an sdk folder like "C:\Program Files\ActuatorSDK\lib\ActuatorSDK.lib" or something like that. )

    Under Configuration Properties > Linker > General > Additional Library Directories, you can specify the folder in which ActuatorSDK.lib is located.

    The actual filenames I'm providing are just placeholder examples.  You need to find out the paths and names that apply to the actual SDK you are using.

    ---

    An alternate way of referencing a library is to place the following in your code:

    #pragma comment( lib, "ActuatorSDK.lib" )

    You still either need to specify the full path of the lib, or add an additional library directory as in the previous instructions.

    Another cool way to do this is to add a new property sheet (.props file) in the same folder as the lib.  Then in the props file, set $(MSBuildThisFileDirectory) as an additional library directory.  This lets you specify the same setting in both Debug and Release mode, and lets you specify both the additional library folders and library paths in the same props file, and keeps relative paths working nicely for committing code to a repository.

    Friday, September 27, 2013 4:54 PM