Details
-
Bug
-
Resolution: Unresolved
-
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.