user1058431
user1058431

Reputation: 185

Boost mingw linking error

I seem to have a problem linking to boost libs using mingw on windows. I search high and low on google and stackoverflow but none of the answers solved the problem.

It can't find or link to "-lboost_threads". Getting an "undefined error" when compiling.

Maybe someone who knows howto can help me solve it.

Using boost v1.48 and mingw on windows.

EDIT:

Error being "...mingw32/bin/ld.exe cannot find -lboost_thread", as it probably usually would in this case.

Thanks.

Upvotes: 0

Views: 1290

Answers (1)

Kos
Kos

Reputation: 72299

The linker command line argument -lboost_thread means that the linker shall look boost_thread in its library paths (which you can add using -Lpath/to/library. It tries to find the library in a file with one of the following filenames:

  • libboost_thread.a (GCC-type archive library - this is what you need in this case)
  • boost_thread.lib (MSVC libs- note that MinGW can link them if they're in C, not C++))
  • and a couple more extensions (not relevant).

Anyway, this error message means that the linker cannot find such library in the include paths. Check where the library file is located (you should know that); if it's in your compiler's lib folder, then it's already in a place where your linker would find it. Maybe you've misspelled the name? Otherwise add an appropriate -L command line argument so that the linker would know where to look for the file.

(Also boost_thread or boost_threads?)

Upvotes: 3

Related Questions