How to link a .LIB in a MS Visual Studio / Intel F

2019-09-11 04:22发布

问题:

I have Visual Studio 2005 integrated with Intel Fortran 11.0. I need to link my project to an existing library C:\mydir2\mydir1\mylib.lib. How do I do that?

I added the path (C:\mydir2\mydir1) to Linker/General/Additional Library Directories and the file name with its path (C:\mydir2\mydir1\mylib.lib) to Linker/Advanced/Import Library, to no avail. I'm missing something somewhere, but don't know what.

Any ideas? Thanks.

回答1:

You're not the first to think that "Import Library" is the spot for this. What that's actually for is to change the path to the import library created by the linker when you link a DLL. You can, as Hans says, use Additional Dependencies (not obvious, I admit), or even easier, just add the .lib to your project as if it were a source file.

Note also that if the .lib is an output of some other project, you can add that project to the solution and use Project Dependencies to make it a dependent of your executable. Then the .lib will be linked in automatically.