INVALID_SOCKET declaration conflict

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Service Arch
    • 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, Service Arch 2024-03-04, Service Arch 2024-03-18, Service Arch 2024-04-01, Service Arch 2024-04-15, Service Arch 2024-04-29, Networking & Obs 2024-05-27, Networking & Obs 2024-06-10, Networking & Obs 2024-06-24, Networking & Obs 2024-07-08, Networking & Obs 2024-07-22, Networking & Obs 2024-08-05, Networking & Obs 2024-08-19, Networking & Obs 2024-09-02, Networking & Obs 2024-09-16, Networking & Obs 2024-09-30, Networking & Obs 2024-10-14, Networking & Obs 2024-10-28, Networking & Obs 2024-11-11
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

       

            Assignee:
            Patrick Freed
            Reporter:
            Eduard Rius
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: