Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8773879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:25:02+00:00 2026-06-13T18:25:02+00:00

I have a linker problem while compiling mongo db client example on Windows. I’m

  • 0

I have a linker problem while compiling mongo db client example on Windows. I’m using Visual Studio 2012.

I’m trying to compile src\mongo\client\examples\clientTest.cpp from mongo’s git.

I did following steps:

  • Built Boost v1.51 using bjam2. I’m using it on another project so I know binaries are good.
  • Built MongoDB C++ driver as scons --dd mongoclient.lib
  • Included boost include directory in my project as an Additional Include Directory.
  • Define _CRT_SECURE_NO_WARNINGS to avoid warnings on use of strncpy and such by the MongoDB client code.
  • Include the boost (binary) libraries directory to the project.

Still, I get following errors

1>mongoclient.lib(log.obj) : error LNK2019: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,int> const &)" (?convert@path_traits@filesystem3@boost@@YAXPBD0AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV?$codecvt@_WDH@5@@Z) referenced in function "void __cdecl boost::filesystem3::path_traits::dispatch<class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > >(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,int> const &)" (??$dispatch@V?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@@path_traits@filesystem3@boost@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@4@ABV?$codecvt@_WDH@4@@Z)
1>mongoclient.lib(log.obj) : error LNK2019: unresolved external symbol "private: static class std::codecvt<wchar_t,char,int> const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAAPBV?$codecvt@_WDH@std@@XZ) referenced in function "public: static class std::codecvt<wchar_t,char,int> const & __cdecl boost::filesystem3::path::codecvt(void)" (?codecvt@path@filesystem3@boost@@SAABV?$codecvt@_WDH@std@@XZ)
1>mongoclient.lib(log.obj) : error LNK2019: unresolved external symbol "class boost::filesystem3::file_status __cdecl boost::filesystem3::detail::status(class boost::filesystem3::path const &,class boost::system::error_code *)" (?status@detail@filesystem3@boost@@YA?AVfile_status@23@ABVpath@23@PAVerror_code@system@3@@Z) referenced in function "bool __cdecl boost::filesystem3::exists(class boost::filesystem3::path const &)" (?exists@filesystem3@boost@@YA_NABVpath@12@@Z)
1>mongoclient.lib(background.obj) : error LNK2019: unresolved external symbol "public: __thiscall boost::thread::~thread(void)" (??1thread@boost@@QAE@XZ) referenced in function "public: class mongo::BackgroundJob & __thiscall mongo::BackgroundJob::go(void)" (?go@BackgroundJob@mongo@@QAEAAV12@XZ)

So it looks like it ignores #pragma comment lib directives in boost’s headers.

I tried explicitly adding libboost_thread-vc110-mt-sgd-1_51.lib in Linker/Input tab of project settings. It didn’t help.

I tried specifying #pragma comment(lib, "libboost_thread-vc110-mt-sgd-1_51.lib") in main cpp file of the example. It didn’t help either.

But! Adding

#include <boost/thread/thread.hpp>

and

boost::thread _thrd(&Func);
_thrd.join();

at the beginning of clientTest.cpp helped to get rid of error about missing boost::thread::~thread(void). Looks like it forced linker to link to thread’s lib binary.

Unfortunately repeating this trick with <boost/filesystem.hpp> didn’t help 🙁

I also made sure that all LIB files, of Boost and Mongo client, are compiled for 32-bit target using dumpbin.exe.

What else could it be guys ?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:25:04+00:00Added an answer on June 13, 2026 at 6:25 pm

    Looks like my messages to mongo-dev mailing list don’t reach the destination. Perhaps it’s premoderated.

    But I managed to make it work via a bit hacky solution because I never used Scons before.

    Core of the problem was that mongo is prebundled with Boost 1.49 and I have Boost 1.51 installed in my system. I was trying to compile sample against boost 1.51 while mongo was compiled with 1.49 therefore mismatch of certain classes/methods.

    I built library by calling

    scons -j4 --dd --use-system-boost mongoclient.lib

    Also I modified SConstruct script. Find line elif "win32" == os.sys.platform:. In this section I added

    env.Append( EXTRACPPPATH=[ "C:/work/externals/boost_1_51_0" ] )

    to specify additional “system” folder.

    Also I had to disable existence check of boost binary libraries which looked like

        for b in boostLibs:
            l = "boost_" + b
            if not conf.CheckLib([ l + boostCompiler + "-mt" + boostVersion,
                                   l + boostCompiler + boostVersion ], language='C++' ):
                Exit(1)
    

    because naming of my libraries is very different.

    Of course it doesn’t cover situation when boost is dynamically compiled with MSVC libraries.

    I hope Mongo team or somebody who knows Scons well will modify build script to

    • Allow to specify path to system boost library
    • Allow building dynamically linked libraries for MSVC
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using codeblocks as my IDE. I have all the linker settings perfect,
I am using Scons to build my C project. I have an external linker
I have put together an example page detailing my problem My website is going
{NOTE}: Visual Studio Dos support .ipp file. The problem here is more manual inefficiency
i have a Problem while testing my DAOObject. I have two Entitys which are
I have the following problem using template instantiation [*]. file foo.h class Foo {
I have a problem with the linker when I build my current project. The
I have a weird problem. I am working on a shared library, written using
I'm working for a while with OpenCV 2.3.1 and MS Visual Studio 2010 now
C++ projects have a linker option to embed manifest to require UAC elevation (/MANIFESTUAC:level)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.