Alban
Alban

Reputation: 7

LNK1104: cannot open file 'libboost_program_options-vc100-mt-sgd-1_56.lib'

I get this error when trying to compile in VS2010:

LNK1104: cannot open file 'libboost_program_options-vc100-mt-sgd-1_56.lib'

I have read through many similar questions here on stackoverflow but still cant fix it.

The file 'libboost_program_options-vc100-mt-gd-1_56.lib' is present but 'libboost_program_options-vc100-mt-sgd-1_56.lib' (note the s in sgd versus gd) is not in my lib folder.

I probably need to change someting in the project settings to get rid of the s!? Or I need to compile the boost libraries in a different way? Or it is none of the above..!?

I hope someone can point me in the right direction.

Maybe it helps, I'm trying to compile voronoi.cpp from https://github.com/thegrandpoobah/voronoi

I downloaded Boost 1.56 and compiled the libraries binary using:

bootstrap
.\b2

as described in the getting started file.

Upvotes: 0

Views: 2013

Answers (1)

Qortex
Qortex

Reputation: 7466

In Short

You are linking against static libraries (hence the 's' in the lib name). Probably because you are generating your project under the "Multithreaded" or "Multithreaded Debug" setting in "Code Generation" under Visual Studio.

These libraries are not built by default when you build boost with

b2

You need to run instead

b2 build-type=complete

to also generate static versions of the boost libs.

In details

In file boostcpp.jam, build options are defined (for Windows target) as:

self.minimal-properties-win = [ property-set.create <variant>debug
        <variant>release <threading>multi <link>static <runtime-link>shared
        <address-model>32 <address-model>64 ] ;

self.complete-properties = [ property-set.create
    <variant>debug <variant>release
    <threading>multi
    <link>shared <link>static
    <runtime-link>shared <runtime-link>static ] ;

self.complete-properties-win = [ property-set.create
    <variant>debug <variant>release
    <threading>multi
    <link>shared <link>static
    <runtime-link>shared <runtime-link>static
    <address-model>32 <address-model>64 ] ;

The <link> options stand for the built libs themselves, whereas <runtime-link> stand for the type of lib they actually are once built.

So with minimal-properties, you do not generate <runtime-link>static, which is what you are looking for with the s in the name suffix.

Upvotes: 1

Related Questions