drogonframework / drogonframework/drogon
MinGW: Error in SQLBinder.h - htonll & ntohll already defined
- Dominant language
- C++
- Stars
- 14.3k
- Forks
- 1.4k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 14
Description
The inclusion of Drogon headers under MinGW x64 on Windows breaks the compilation because of already defined *htonll* and *ntohll* [functions](https://github.com/drogonframework/drogon/blob/master/orm_lib/inc/drogon/orm/SqlBinder.h#L71) in SQLBinder.h.
When I comment them out, the process continues without any problems. This doesn't happen on other OSes I'm using, like macOS. For both systems I'm using GNU C++ 12.
```bash
In file included from C:\bin\drogon\include/drogon/orm/DbClient.h:24:
C:\bin\drogon\include/drogon/orm/SqlBinder.h: At global scope:
C:\bin\drogon\include/drogon/orm/SqlBinder.h:71:17: error: redefinition of 'uint64_t htonll(uint64_t)'
71 | inline uint64_t htonll(uint64_t value)
| ^~~~~~
In file included from C:/bin/msys64/mingw64/include/ws2tcpip.h:17,
from C:\bin\drogon\include/trantor/net/InetAddress.h:27:
C:/bin/msys64/mingw64/include/winsock2.h:1015:34: note: 'long long unsigned int htonll(long long unsigned int)' previously defined here
1015 | __forceinline unsigned __int64 htonll(unsigned __int64 Value) { return (((unsigned __int64)htonl(Value & 0xFFFFFFFFUL)) << 32) | htonl((u_long)(Value >> 32)); }
| ^~~~~~
C:\bin\drogon\include/drogon/orm/SqlBinder.h:75:17: error: redefinition of 'uint64_t ntohll(uint64_t)'
75 | inline uint64_t ntohll(uint64_t value)
| ^~~~~~
C:/bin/msys64/mingw64/include/winsock2.h:1025:34: note: 'long long unsigned int ntohll(long long unsigned int)' previously defined here
1025 | __forceinline unsigned __int64 ntohll(unsigned __int64 Value) { return (((unsigned __int64)ntohl(Value & 0xFFFFFFFFUL)) << 32) | ntohl((u_long)(Value >> 32)); }
| ^~~~~~
```
Contributor guide
Assessment
This issue has not been assessed yet.