将库添加到 Visual Studio 2008 C++ 项目
我对 Visual Studio 完全陌生,在使用 Visual Studio 2008 启动项目时遇到一些问题。我正在尝试使用 MAPI,当我去构建项目时收到类似这样的错误消息:
“未解决函数 _main 中引用的外部符号 _MAPIUninitialize@0”
我知道我需要链接到 MAPI32.lib,但到目前为止我找到的指南表明转到“Visual Studio 设置 链接 选项卡”并添加它在那里(显然是来自旧版本的 Visual Studio)。 我在 VS 2008 的项目属性链接器或 C/C++ 部分中找不到类似的内容。
我需要在哪里告诉 Visual Studio 使用该库?
谢谢
I'm completely new to Visual Studio and I'm having some trouble getting a project started with Visual Studio 2008. I'm experimenting with MAPI, and I'm getting error messages like this when I go to build the project:
"unresolved external symbol _MAPIUninitialize@0 referenced in function _main"
I know I need to link to MAPI32.lib, but the guides I have found thus far have indicated going to the "Visual Studio settings link tab" and adding it there (which was - apparently - from an older version of Visual Studio). I can't find anything like that in the project properties linker or C/C++ sections of VS 2008.
Where do I need to tell Visual Studio to use that library?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
它位于项目属性/配置属性/链接器/输入/附加依赖项下。
屏幕底部的帮助提示显示“指定添加到行的其他项目(例如:kernel32.lib)”。
It's under Project Properties / Configuration Properties / Linker / Input / Additional Dependencies.
The help tip at the bottom of the screen says "Specifies additional items add to the line line (ex: kernel32.lib)".
项目属性->链接器->输入->附加依赖项
也可以使用
#pragma comment(lib, "mapi32")
在您的源文件之一中。 正如 MSDN 所指出的,这里是使用 pragma 技术的类似库添加 MSDN - 创建基本 Winsock 应用程序
Project Properties->Linker->Input->Additional Dependencies
You can also use
#pragma comment( lib, "mapi32" )
in one of your source files. As noted MSDN here is a similar library addition using the pragma technique MSDN - Creating a Basic Winsock Application
三个简单的步骤:
选择包含 .lib 文件的文件夹
2.Project Properties->Linker->Input->Additional Dependency
只需输入您的.lib文件的名称
3.Project Properties->C/C++->General->Additional Include Directoryies
选择 .h 文件所在的文件夹
Three simple steps:
choose the folder which contains your .lib file
2.Project Properties->Linker->Input->Additional Dependencies
Just enter the name of your .lib files
3.Project Properties->C/C++->General->Additional Include Directories
choose the folder where your .h files locate
也可以将库文件拖放到解决方案资源管理器中的项目中。
It is also possible to just drag'n'drop library file to project in Solution Explorer.
不要静态链接到任何 MAPI dll。 您必须始终动态加载 MAPI 系统 - 查看 MFCMAPI 源代码以了解它是如何完成的:http://mfcmapi。 codeplex.com/
Do not statically link to any MAPI dlls. You must always dynamically load the MAPI system - look at the MFCMAPI source code to see how it is done: http://mfcmapi.codeplex.com/