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

时间:2021-04-01 22:37:25

I just started writing a small application in C++ using Visual Studio C++ 2008 Express. I installed the Boost Library using the Windows installer. While compiling the program I get the following error :

我刚开始使用Visual Studio C ++ 2008 Express在C ++中编写一个小应用程序。我使用Windows安装程序安装了Boost Library。在编译程序时,我收到以下错误:

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'

编译... stdafx.cpp编译... websave.cpp GoogleAuthenticate.cpp生成代码...将清单编译到资源... Microsoft(R)Windows(R)资源编译器版本6.1.6723.1版权所有(C)Microsoft Corporation。版权所有。链接...链接:致命错误LNK1104:无法打开文件'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)
{
}

// websave.cpp

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

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

I checked the boost/boost-1.38/lib folder and the libboost_system-vc90-mt-gd-1_38.lib is present there. Also added the path in "Additional Include Directories" in Configuration Properties of the project.

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

Is there anything that is being missed here ?

这里有什么遗漏吗?

3 个解决方案

#1


You can also add it to the library directories for that specific project. Right click on the project, properties -> Linker -> General -> Additional Library Directories.

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

We do this because we can have different versions of boost with different projects in our configuration management structure. If you just want to use whatever version is installed on your PC, use the setting from the tools menu: Tools -> Options -> Projects and Solutions -> VC++ Directories -> Library Files.

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

#2


You'll also want to add that directory to the list of library directories.

您还需要将该目录添加到库目录列表中。

Tools | Options | Projects | VC++ Directories

#3


Forgot to add this : In Configuration Properties > Linker > Additional Library Directories, enter the path to the Boost binaries, e.g. C:\Program Files\boost\boost_1_38_0\lib.

忘记添加:在“配置属性”>“链接器”>“其他库目录”中,输入Boost二进制文件的路径,例如C:\ Program Files \ boost \ boost_1_38_0 \ lib。

Should have RTFM. http://www.boost.org/doc/libs/1_36_0/more/getting_started/windows.html#link-from-within-the-visual-studio-ide

应该有RTFM。 http://www.boost.org/doc/libs/1_36_0/more/getting_started/windows.html#link-from-within-the-visual-studio-ide

Fixed.

#1


You can also add it to the library directories for that specific project. Right click on the project, properties -> Linker -> General -> Additional Library Directories.

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

We do this because we can have different versions of boost with different projects in our configuration management structure. If you just want to use whatever version is installed on your PC, use the setting from the tools menu: Tools -> Options -> Projects and Solutions -> VC++ Directories -> Library Files.

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

#2


You'll also want to add that directory to the list of library directories.

您还需要将该目录添加到库目录列表中。

Tools | Options | Projects | VC++ Directories

#3


Forgot to add this : In Configuration Properties > Linker > Additional Library Directories, enter the path to the Boost binaries, e.g. C:\Program Files\boost\boost_1_38_0\lib.

忘记添加:在“配置属性”>“链接器”>“其他库目录”中,输入Boost二进制文件的路径,例如C:\ Program Files \ boost \ boost_1_38_0 \ lib。

Should have RTFM. http://www.boost.org/doc/libs/1_36_0/more/getting_started/windows.html#link-from-within-the-visual-studio-ide

应该有RTFM。 http://www.boost.org/doc/libs/1_36_0/more/getting_started/windows.html#link-from-within-the-visual-studio-ide

Fixed.