moth
moth

Reputation: 375

VS2010 - Linker error with adding static library

I wanted to create a static library to use in my project like Boost library for example.
So I created a Win32 console application project and I chose static library and I compiled it.
Then, in my project I added the directory containing .h file in Properties/Configuration Properties/VC++ Directorie/Include Directories and the directory containing .lib file in Properties/Configuration Properties/VC++ Directorie/Libraries Directories like Boost library, but I have error "LNK2019 unresolved external symbol".

Why it simply doesn't work like boost library while I make the same process?

Upvotes: 0

Views: 191

Answers (2)

doctorlove
doctorlove

Reputation: 19262

You need to specify the name of the library to use (in additional dependencies in the linker options) as well as tell it which directory the additional libraries are in.

You can use #pragma comment instead, but it can be more manageable to use the build settings.

Upvotes: 0

Dean
Dean

Reputation: 86

may be you forgot to write:

#pragma comment(lib, "boost.lib")

in your code

Upvotes: 1

Related Questions