Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-944

mongocxx::database::stats() causes error LNK2019: unresolved external symbol

    • Type: Icon: Task Task
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.1
    • Component/s: Implementation
    • None
    • Environment:
      Windows 10
      MS VS 2015
      MongoDB 3.3.5
      MongoDB C++11 Driver 3.0.1

      bsoncxx::document::value statistics = db.stats();

      gives me this link error:

      stats_and_info.obj : error LNK2019: unresolved external symbol "_declspec(dllimport) public: class bsoncxx::v_noabi::document::value __cdecl mongocxx::v_noabi::database::stats(void)" (imp?stats@database@v_noabi@mongocxx@@QEAA?AVvalue@document@2bsoncxx@@XZ) referenced in function "void __cdecl T4Stats::PrintStatisticsForOneApplication(class T4Application const &)" (?PrintStatisticsForOneApplication@T4Stats@@YAXAEBVT4Application@@@Z)

      This is the only error I get in a complex compile involving many thousands of lines of mongoDB C++11 code (I'm upgrading from 2.3 to 3.3.5). I am compiling with /Gd (__cdecl calling convention) even though the examples used /Gv which wrecked havoc with my use of Boost 1.60. Taking out this line, the solution compiles and links fine.

            Assignee:
            Unassigned Unassigned
            Reporter:
            therefore George Thompson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: