Adding .lib files in Microsoft Visual Studio 2010
I just开发者_如何学运维 downloaded Visual Studio 2010, and they changed a lot since Visual Studio 2008. These options were changed: the header includes, the lib directory to add, and all changed.
I followed a series of tutorials to do that, but in the other version I just had to add the mylib.lib string in the textfield, but now I look over and over, and I can't find a place to paste that mylib.lib to link with my project.
Where can I find it?
If you're looking for how to get a lib file imported in to your project, you can do this either by editing the project settings, under Linker>Input:
...or you can use a #pragma
...
#pragma comment( lib, "MyLib.lib" )
I typically add this right in to the header file for the library I want to import. Alternatively, you can add it to any header or CPP file in your project.
I personally prefer to do it this way, right in code:
#pragma comment(lib, "mylib.lib")
This way you don't need to look for the field you need under project settings.
See also: What does "#pragma comment" mean?
精彩评论