First Boost program
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开发者_如何学Python), 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?
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)
Make sure you have the Windows SDK installed.
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
.
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.
精彩评论