如何在Visual Studio 2012中链接到.a文件? [英] How to link against .a files in Visual Studio 2012?

查看:259
本文介绍了如何在Visual Studio 2012中链接到.a文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些.a文件形式的静态库以及随附的标头(.h)文件.如何告诉链接器Visual Studio 2012 Windows Desktop Express引用这些文件,以便在尝试构建时不会出现无法解析的外部符号"错误?

I have some static libraries in the form of .a files, and accompanying header (.h) files. How can I tell the linker Visual Studio 2012 Windows Desktop Express to reference these files so that I don't get "unresolved external symbol" errors when I try to build?

推荐答案

  • 包括.h标头文件,并确保它们存在于您的项目中
  • 转到项目属性">配置属性">"C/C ++">常规">其他包含目录",然后将路径添加到可以在其中找到头文件的包含目录
  • 转到项目属性>配置属性>链接器>常规>其他库目录,然后将路径添加到可找到.a文件的lib目录中
  • 转到项目属性">配置属性">链接器">输入">其他依赖项",然后准确添加.a文件
  • 除此之外,请确保您在构建时使用正确的配置平台(x86与x64),并且该库与您的库所使用的平台相同.

    Apart from this make sure you are in the correct configuration platform while building (x86 vs x64) and it is same as the one your library uses.

    这篇关于如何在Visual Studio 2012中链接到.a文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆