简体   繁体   中英

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.

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?)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM