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

Driver won't compile on Windows with cl.exe (MSVC compiler)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • legacy-0.11.0
    • Affects Version/s: legacy-0.10.0
    • Component/s: Build

      Not sure if anyone tried compiling it with Microsoft Visual Studio C++ (I use most recent 2013 build), but it won't compile due to a problem with certain windows headers.

      I tracked it down to two cases - one where mongo/platform/process_id.h fails because certain file that includes it doesn't also include "mongo/platform/basic.h" which in turn includes required windows headers (it lacks definition of DWORD). Another problem is with net/sock.h which, on the other hand, misses definition of sockaddr.

      It seems that only certain .cpp files include "mongo/platform/basic.h" and its not enough. I solved it temporarily by just including this file in both, process_id.h and sock.h. Not sure what the intentions were, but either its basic and should be included in every file, or its selectively included in files that need it, but then it seems quite a lot of files were omitted - almost every file compiled throws an error because it either lacks DWORD def or sockaddr.

      I attached compiler error.

        1. error.txt
          5 kB
        2. sock_h_error.txt
          8 kB

            Assignee:
            tyler@10gen.com Tyler Brock
            Reporter:
            noizex Kamil N
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: