views:

965

answers:

3

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 ?

A: 

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

Tools | Options | Projects | VC++ Directories
Paul Mitchell
Added it. Same error.
vivekian2
A: 

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.

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

Fixed.

vivekian2
+1  A: 

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.

teeks99