c++ - 在 Visual Studio C++ 2008 Express 中使用 Boost Asio 构建应用程序时出现链接器错误

标签 c++ visual-studio boost linker

我刚开始使用 Visual Studio C++ 2008 Express 用 C++ 编写一个小应用程序。我使用 Windows 安装程序安装了 Boost 库。编译程序时出现以下错误:

Compiling...
stdafx.cpp
Compiling...
websave.cpp
GoogleAuthenticate.cpp
Generating Code...
Compiling manifest to resources...
Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
Copyright (C) Microsoft Corporation. All rights reserved.
Linking...
LINK : fatal error LNK1104: cannot open file 'libboost_system-vc90-mt-gd-1_38.lib'

//GoogleAuthenticate.h

#pragma once
#include <boost/asio.hpp>

class GoogleAuthenticate
{
  public:
        GoogleAuthenticate(void);
        virtual ~GoogleAuthenticate(void);
};

//GoogleAuthenticate.cpp

#include "StdAfx.h"
#include "GoogleAuthenticate.h"


GoogleAuthenticate::GoogleAuthenticate(void)
{
}

GoogleAuthenticate::~GoogleAuthenticate(void)
{
}

//网络保存.cpp

#include "stdafx.h"
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{ 
    cout << "hello" << endl; 
return 0;
}

我检查了 boost/boost-1.38/lib 文件夹,其中存在 libboost_system-vc90-mt-gd-1_38.lib。还在项目的配置属性中的“其他包含目录”中添加了路径。

这里有什么遗漏的吗?

最佳答案

您还可以将它添加到该特定项目的库目录中。右键单击项目,属性 -> 链接器 -> 常规 -> 附加库目录。

我们这样做是因为我们可以在我们的配置管理结构中为不同的项目使用不同版本的 boost。如果您只想使用 PC 上安装的任何版本,请使用工具菜单中的设置:工具 -> 选项 -> 项目和解决方案 -> VC++ 目录 -> 库文件。

关于c++ - 在 Visual Studio C++ 2008 Express 中使用 Boost Asio 构建应用程序时出现链接器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/704294/

相关文章:

c++在任何时候写入流时执行函数

c++:静态断言检查使用的const是否在预定义列表中

c# - 我的 DLL 有 4 个副本而不是 1 个?

visual-studio - Visual Studio 2010 是否仍能使用 Visual Studio 2008 的所有插件?

C++11 初始化列表 + 函数指针让我头疼

.net - 为什么Visual Studio不允许我进入Type.GetType()?

c++ - C++中有排序集合吗?

c++ - ofstream(mode ios::out) 在系统停止时删除现有文件空白

c++ - 带 Boost 的多态序列化

c++ - 什么时候适合使用虚方法?