【发布时间】:2014-11-20 06:38:30
【问题描述】:
我正在尝试使用 Visual Studio 2012 访问 .lib 文件。以下是我遵循的步骤
-
创建一个类库,并包含头文件(.hpp)和.lib文件
头文件:-
extern "C" unsigned int GetKey();类库
public: static unsigned int GetKey1() { return GetKey(); } 应用构建成功,我们将其称为类库
- 创建了一个win 32控制台应用程序并添加了上面的dll作为参考,尝试访问dll中的方法,构建成功,但是当我尝试运行它时,它显示文件未找到异常 在 classlibrary.dll 或其依赖项中,如下所示。
源文件
using namespace ManagedMathFuncsLib;
int main()
{
Class1 cs;
cout<<"default value of variable from dll : "<< cs.GetKey1()<<endl;
return 0;
}
错误
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module.
补充资料:Could not load file or assembly 'XXXXXXX.dll' or one of its dependencies. The specified module could not be found.
如果有这个异常的处理程序,程序可以安全地继续。
**Do i need the dll related to .lib file? Please help.**
【问题讨论】:
标签: winapi dll static-libraries class-library .lib