Link to home
Start Free TrialLog in
Avatar of zzhang2006
zzhang2006Flag for United States of America

asked on

How to link to a static lib in Visual Studio C++ 2010 Express/ Console applications

I seem to be able to create a myfunction.lib with VS Studio 2010 Express. Now I try to use access the functions
within it from another Console application project:  app_test.cpp.  But  can't.  I followed some links online that instructed be to go to  Properties->Common Properties->Framwork and Reference-> Add New Reference
; I got there, but all I saw was an empty window that has "Project name and Project Directory" pane, and apparent
the OK button is grayed out, while I was expecting it to let be browse for the said lib file or some directories to find the newly built library file.  Am I missing anything?

Experts, helps with picture or video links would be highly appreciated.
Thanks in advance
Avatar of chaau
chaau
Flag of Australia image

From what you have described it seems that you use a native VC++. The "some links" instructed you for to add a reference to a .Net assembly.
Here is the correct link https://msdn.microsoft.com/en-us/library/ms235627.aspx

Navigate to the section Using the functionality from the static library in the app and follow the steps exactly, including the setting of the paths.

If everything else fails use the old school method: copy the .h and .lib files to your another console application folder. In the cpp file type #include "myfunction.h". Right click on the application folder in the solution explorer, select properties. Navigate to Linker->Input and type the myfunction.lib in the Additional Dependencies there:User generated image
ASKER CERTIFIED SOLUTION
Avatar of sarabande
sarabande
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial