c++ - 如何在Visual Studio中链接库

标签 c++ visual-studio-2010 linker static-libraries

我正在尝试使用 SMILE 库 ( http://genie.sis.pitt.edu/index.php/downloads ) 在 C++ 中创建一个项目。我在网站上下载了 x64 的 Visual Studio 2010/VC 10.0 SP1 版本(我安装了 Windows 7 和 Visual Studio 2010)。创建新项目后,我转到项目属性->配置->C/C++->附加包含目录,并设置包含库的文件夹的路径。当我尝试编译时出现错误:

1>------ Inizio compilazione: Progetto: IDSS_2013, Configurazione: Debug Win32 ------
1>  stdafx.cpp
1>  AssemblyInfo.cpp
1>  IDSS_2013.cpp
1>  Generazione del codice in corso...
1>  .NETFramework,Version=v4.0.AssemblyAttributes.cpp
1>LINK : fatal error LNK1104: impossibile aprire il file 'smile_dbg.lib'
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========

来源是文档中示例提供的来源:

#include "smile.h"

#include <stdio.h>

void CreateNetwork(void);
void InfereceWithBayesNet(void);
void UpgradeToInfluenceDiagram(void);
void InferenceWithInfluenceDiagram(void);
void ComputeValueOfInformation(void);

int main()
{
 CreateNetwork();
 InfereceWithBayesNet();
 UpgradeToInfluenceDiagram();
 InferenceWithInfluenceDiagram();
 ComputeValueOfInformation();
 return(DSL_OKAY);
};

最佳答案

使用#pragma注释添加库或使用项目设置(链接器->输入)

关于c++ - 如何在Visual Studio中链接库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14836343/

相关文章:

c++ - 使方法显式,除了友元类

c++ - 如何在 C++ 中围绕异步回调创建同步包装器?

c# - 使用 LINQ 解析 XML 字符串(带命名空间)

visual-studio-2010 - 复制数据驱动测试的行为

linker - SEGMENT_START ("text-segment", 0x400000) 代表什么?

c++ - 用时间检查数据?

c++ - Qt - 从对象数组启动 5 个线程时出错

c++ - stdafx.h 的目的(和 : Why doesn't this work? )

c++ - 链接 SFML 时出错。 LNK2001

c++ - GCC:如何找到不丢弃目标文件的原因