Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-80231

INVALID_SOCKET declaration conflict

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • None
    • None
    • Service Arch
    • Minor Change
    • Service Arch 2023-11-13, Service Arch 2023-11-27, Service Arch 2023-12-11, Service Arch 2023-12-25, Service Arch 2024-01-08, Service Arch 2024-01-22, Service Arch 2024-02-05, Service Arch 2024-02-19

    Description

      Summary

      The following error outputs when including mongo dependencies on the code:

      error: expected unqualified-id before '-' token

      const int INVALID_SOCKET = -1;

      Environment

      Found on Ubuntu 20.04 using gcc 9.3.

      How to Reproduce

       

      #include <httplib.h>
      #include <mongo/util/net/sock.h>
       
      int main(int argc, char **argv)
      { 
        return 0;
      } 

      The error appears because both used libraries define INVALID_SOCKET but mongo does not check if it exists. Just adding an if statement solves the issue.

       

      Attachments

        Activity

          People

            patrick.freed@mongodb.com Patrick Freed
            eduard.rius.martinez@gmail.com Eduard Rius
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: