views:

146

answers:

4

I have tried to write my first Boost program from information on the Boost libraries site. Here is the code:

#include <boost/lambda/lambda.hpp>

#include <iostream>
#include <iterator>
#include <algorithm>

int main()
{
    using namespace boost::lambda;
    typedef std::istream_iterator<int> in;

    std::for_each(
        in(std::cin), in(), std::cout << (_1 * 3) << " " );
}

It shows me this error:

1>------ Build started: Project: boost_librarys, Configuration: Debug Win32 ------
1>  boost_librarys.cpp
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

How can this error be fixed?

+5  A: 

The answer to a similiar question outside SO was:

Download and install the Windows SDK from here

(link in quote may not be fitting for your system)

Andreas_D
kernel32.lib is always installed with VS (well, maybe except for bitorrent versions, i don't know)
Calvin1602
+2  A: 

Make sure you have the Windows SDK installed.

James
+1  A: 

The link error you're getting means that your program isn't linking to the correct libraries. Since the error refers to a Microsoft system library (kernel.lib), you'll need to make sure you've got your system set up correctly. This isn't a Boost problem per se, although it may be Boost that's interested in linking with kernel.lib.

Max Lybbert
Actually, kernel32.lib is on the list of default libraries as it's used by Visual Studio's Standard Library (MSVCRT)
MSalters
@MSalters: So it's not a Boost problem _per se_ and the original poster should check that his system is set up correctly.
Max Lybbert
@Max: My statement was and is that is is _provably not_ a Boost problem. "Not _per se_ a Boost problem" keeps the possibility open that is is.
MSalters
A: 

You are on Visual, there is NO reason why kernel32.lib wouln'd be around. Anyway, it should be in C:/Program Files(x86)/MS Visual Studio/VC/lib

My guess is that you mistyped something in the project's configuration. Every lib, every additional path should be separated by a ';'. If you're unsure, click on the right [...] , in the new window there should be one item by line only.

Calvin1602