开发者

How to link a .lib in Visual Studio 2008 C++

I'm finding it really difficult to properly link a .lib file to my C++ Win32 Console Application. Here's my problem.

Just as in this MSDN article, I have developed a MathFuncsLib.lib file.

http://msdn.microsoft.com/en-us/library/ms235627%28v=vs.80%29.aspx

Then, in the MyExecRefsLib Win32 Console App, I want to link to the above file. So, inside MyExecRefsLib folder (same folder where .sln file resides) I created a directory called "LibraryFiles" and placed both MathFuncsLib.lib file AND MathFuncsLib.h file.

Then, in Properties->Linker->Input I added both "MathFuncsLib.lib" and "MathFuncsLib.h" (without full path) and then in Properties->Linker->Additional Library Directories I added the path to my folder 开发者_Python百科"LibraryFiles" which is what pretty much EVERY thread on the web about this problem tells me to do.

But now it gives me the following error:

fatal error C1083: Cannot open the include file. 'MathFuncsLib.h': No such file or directory.

What am I doing wrong? Please help. Note that my code is exactly the same as what's in the above given MSDN link.


To link with a .lib file, you just need to:

  • right clic on the project name, select Properties
  • under Properties->configuration properties->C/C++->General item "other include directories" add the path to your .h file
  • under Properties->Linker->Input add the path and name of your .lib file

And that's it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜