C++ – Linker Error while building application using Boost Asio in Visual Studio C++ 2008 Express

boostclinkervisual studio

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 :

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)
{
}

// 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.

Is there anything that is being missed here ?

Best Answer

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.