0

I recently started using the Boost Library and I am having problems with installing it.

What I did so far was:

  • Download the lib , extracting it to "C:/Boost" Directory.
  • Entering the Visual Studio 2012 CMD + did "cd C:/Boost/boost1_56_0".
  • Typing the bootstrap.bat command and afterwards the b2 command.
  • Entered Visual and added in the C/C++ General -> Additional Include Directories the directory of the boost root lib that I extracted earlier.
  • In Configuration Properties > C/C++ > Precompiled Headers, change Use Precompiled Header (/Yu) to Not Using Precompiled Headers

In that project I made a main.cpp file that contains:

#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) << " " );
}

For some reason, and I don't have a clue any more, I get these errors:

  1. LNK2019 - unresolved external symbol _WinMain@16 referenced in function __tmainCRTStartup
  2. LNK1120 - 1 unresolved externals

I tried toying with the configurations and the commands from few places from the internet with no result. Why could this be happening?

KiaMorot
  • 1,668
  • 11
  • 22
  • 3
    It seems you didn't create a console project, so the main starting point isn't the `main` function, it's one called `WinMain`. – Some programmer dude Sep 15 '14 at 12:03
  • ***1.LNK2019 - unresolved external symbol _WinMain@16 referenced in function __tmainCRTStartup 2. LNK1120 - 1 unresolved externals*** You selected a windows application (not a console application) but do not have a WinMain. – drescherjm Sep 15 '14 at 12:03

1 Answers1

1

Create a new console project in visual studio and it should work for you.

The reason you get this error is you have created a windows application, and a windows applications entry point is called WinMain.

main is the entry point for console applications, which is correct in your situation.

Whereas the linker is looking for WinMain which causes an error as it can not find the entry point hence the unresolved external symbol.

Niall
  • 30,036
  • 10
  • 99
  • 142
06needhamt
  • 1,555
  • 2
  • 19
  • 38