- Revenera Community
- :
- FlexNet Publisher
- :
- FlexNet Publisher Forum
- :
- FlexNet 11.19.5 build on Visual Studio 2015
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hi all,
I am trying to build my app with FlexNet 11.19.5. I am facing some compiler issues (Visual Studio 2015):
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(100): warning C4005: 'AF_IPX': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(452): note: see previous definition of 'AF_IPX'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(140): warning C4005: 'AF_MAX': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(471): note: see previous definition of 'AF_MAX'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(177): warning C4005: 'SO_DONTLINGER': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(394): note: see previous definition of 'SO_DONTLINGER'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(221): error C2011: 'sockaddr': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1002): note: see declaration of 'sockaddr'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(421): error C2059: syntax error: 'constant'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(421): error C3805: 'constant': unexpected token, expected either '}' or a ','
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(556): warning C4005: 'IN_CLASSA': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(279): note: see previous definition of 'IN_CLASSA'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(562): warning C4005: 'IN_CLASSB': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(285): note: see previous definition of 'IN_CLASSB'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(568): warning C4005: 'IN_CLASSC': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(291): note: see previous definition of 'IN_CLASSC'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(579): warning C4005: 'INADDR_ANY': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(296): note: see previous definition of 'INADDR_ANY'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(581): warning C4005: 'INADDR_BROADCAST': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(298): note: see previous definition of 'INADDR_BROADCAST'
c:\program files (x86)\windows kits\8.1\include\shared\ws2def.h(615): error C2011: 'sockaddr_in': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1006): note: see declaration of 'sockaddr_in'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(136): error C2011: 'fd_set': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1014): note: see declaration of 'fd_set'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(156): warning C4005: 'FD_CLR': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(89): note: see previous definition of 'FD_CLR'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(171): warning C4005: 'FD_SET': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(94): note: see previous definition of 'FD_SET'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(180): error C2011: 'timeval': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1030): note: see declaration of 'timeval'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(236): error C2011: 'hostent': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1018): note: see declaration of 'hostent'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(249): error C2011: 'netent': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(172): note: see declaration of 'netent'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(256): error C2011: 'servent': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1022): note: see declaration of 'servent'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(268): error C2011: 'protoent': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1026): note: see declaration of 'protoent'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(364): error C2011: 'WSAData': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(314): note: see declaration of 'WSAData'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(462): error C2011: 'sockproto': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(486): note: see declaration of 'sockproto'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(504): error C2011: 'linger': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(1010): note: see declaration of 'linger'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(517): warning C4005: 'SOMAXCONN': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(536): note: see previous definition of 'SOMAXCONN'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(551): warning C4005: 'FD_READ': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(554): note: see previous definition of 'FD_READ'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(554): warning C4005: 'FD_WRITE': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(555): note: see previous definition of 'FD_WRITE'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(557): warning C4005: 'FD_OOB': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(556): note: see previous definition of 'FD_OOB'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(560): warning C4005: 'FD_ACCEPT': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(557): note: see previous definition of 'FD_ACCEPT'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(563): warning C4005: 'FD_CONNECT': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(558): note: see previous definition of 'FD_CONNECT'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(566): warning C4005: 'FD_CLOSE': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(559): note: see previous definition of 'FD_CLOSE'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1646): error C2375: 'accept': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(734): note: see declaration of 'accept'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1668): error C2375: 'bind': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(739): note: see declaration of 'bind'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1689): error C2375: 'closesocket': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(744): note: see declaration of 'closesocket'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1706): error C2375: 'connect': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(746): note: see declaration of 'connect'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1727): error C2375: 'ioctlsocket': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(751): note: see declaration of 'ioctlsocket'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1748): error C2375: 'getpeername': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(756): note: see declaration of 'getpeername'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1769): error C2375: 'getsockname': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(761): note: see declaration of 'getsockname'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1790): error C2375: 'getsockopt': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(766): note: see declaration of 'getsockopt'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1815): error C2375: 'htonl': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(773): note: see declaration of 'htonl'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1832): error C2375: 'htons': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(775): note: see declaration of 'htons'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1850): error C2375: 'inet_addr': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(777): note: see declaration of 'inet_addr'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1868): error C2375: 'inet_ntoa': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(779): note: see declaration of 'inet_ntoa'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1968): error C2375: 'listen': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(781): note: see declaration of 'listen'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(1987): error C2375: 'ntohl': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(785): note: see declaration of 'ntohl'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2004): error C2375: 'ntohs': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(787): note: see declaration of 'ntohs'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2021): error C2375: 'recv': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(789): note: see declaration of 'recv'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2044): error C2375: 'recvfrom': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(795): note: see declaration of 'recvfrom'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2071): error C2375: 'select': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(803): note: see declaration of 'select'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2096): error C2375: 'send': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(810): note: see declaration of 'send'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2119): error C2375: 'sendto': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(816): note: see declaration of 'sendto'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2146): error C2375: 'setsockopt': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(824): note: see declaration of 'setsockopt'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2171): error C2375: 'shutdown': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(831): note: see declaration of 'shutdown'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2191): error C2375: 'socket': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(835): note: see declaration of 'socket'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2216): error C2375: 'gethostbyaddr': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(842): note: see declaration of 'gethostbyaddr'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2238): error C2375: 'gethostbyname': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(847): note: see declaration of 'gethostbyname'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2255): error C2375: 'gethostname': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(849): note: see declaration of 'gethostname'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2295): error C2375: 'getservbyport': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(853): note: see declaration of 'getservbyport'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2314): error C2375: 'getservbyname': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(857): note: see declaration of 'getservbyname'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2333): error C2375: 'getprotobynumber': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(861): note: see declaration of 'getprotobynumber'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2350): error C2375: 'getprotobyname': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(863): note: see declaration of 'getprotobyname'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2370): error C2375: 'WSAStartup': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(867): note: see declaration of 'WSAStartup'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2390): error C2375: 'WSACleanup': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(871): note: see declaration of 'WSACleanup'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2407): error C2375: 'WSASetLastError': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(873): note: see declaration of 'WSASetLastError'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2424): error C2375: 'WSAGetLastError': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(875): note: see declaration of 'WSAGetLastError'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2445): error C2375: 'WSAIsBlocking': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(877): note: see declaration of 'WSAIsBlocking'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2463): error C2375: 'WSAUnhookBlockingHook': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(879): note: see declaration of 'WSAUnhookBlockingHook'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2481): error C2375: 'WSASetBlockingHook': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(881): note: see declaration of 'WSASetBlockingHook'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2499): error C2375: 'WSACancelBlockingCall': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(883): note: see declaration of 'WSACancelBlockingCall'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2517): error C2375: 'WSAAsyncGetServByName': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(885): note: see declaration of 'WSAAsyncGetServByName'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2545): error C2375: 'WSAAsyncGetServByPort': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(893): note: see declaration of 'WSAAsyncGetServByPort'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2573): error C2375: 'WSAAsyncGetProtoByName': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(901): note: see declaration of 'WSAAsyncGetProtoByName'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2599): error C2375: 'WSAAsyncGetProtoByNumber': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(908): note: see declaration of 'WSAAsyncGetProtoByNumber'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2625): error C2375: 'WSAAsyncGetHostByName': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(915): note: see declaration of 'WSAAsyncGetHostByName'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2651): error C2375: 'WSAAsyncGetHostByAddr': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(922): note: see declaration of 'WSAAsyncGetHostByAddr'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2681): error C2375: 'WSACancelAsyncRequest': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(931): note: see declaration of 'WSACancelAsyncRequest'
c:\program files (x86)\windows kits\8.1\include\um\winsock2.h(2699): error C2375: 'WSAAsyncSelect': redefinition; different linkage
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(933): note: see declaration of 'WSAAsyncSelect'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(76): error C2079: 'sockaddr_gen::Address' uses undefined struct 'sockaddr'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(77): error C2079: 'sockaddr_gen::AddressIn' uses undefined struct 'sockaddr_in'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(120): warning C4005: 'IP_TOS': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(344): note: see previous definition of 'IP_TOS'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(121): warning C4005: 'IP_TTL': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(343): note: see previous definition of 'IP_TTL'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(122): warning C4005: 'IP_MULTICAST_IF': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(338): note: see previous definition of 'IP_MULTICAST_IF'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(123): warning C4005: 'IP_MULTICAST_TTL': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(339): note: see previous definition of 'IP_MULTICAST_TTL'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(124): warning C4005: 'IP_MULTICAST_LOOP': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(340): note: see previous definition of 'IP_MULTICAST_LOOP'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(125): warning C4005: 'IP_ADD_MEMBERSHIP': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(341): note: see previous definition of 'IP_ADD_MEMBERSHIP'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(126): warning C4005: 'IP_DROP_MEMBERSHIP': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(342): note: see previous definition of 'IP_DROP_MEMBERSHIP'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(127): warning C4005: 'IP_DONTFRAGMENT': macro redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(345): note: see previous definition of 'IP_DONTFRAGMENT'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(202): error C2079: '_SOCKADDR_INET::Ipv4' uses undefined struct 'sockaddr_in'
c:\program files (x86)\windows kits\8.1\include\shared\ws2ipdef.h(715): error C2011: 'ip_mreq': 'struct' type redefinition
c:\program files (x86)\windows kits\8.1\include\um\winsock.h(355): note: see declaration of 'ip_mreq'
I found some hints regarding ordering some includes:
https://stackoverflow.com/questions/22517036/socket-errors-cant-get-functions-in-winsock2-h
Do you guys have any idea how can I fix this?
Thank you.
Tomas C.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
This is very likely coming from a double include of ws2tcpip.h in the header file machined/lmclient.h.
I have to comment out the line 62 in that header file in order to compile our client library since v11.19.4 of FNP on Windows, and that even when building with MSVC 2022.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
This is very likely coming from a double include of ws2tcpip.h in the header file machined/lmclient.h.
I have to comment out the line 62 in that header file in order to compile our client library since v11.19.4 of FNP on Windows, and that even when building with MSVC 2022.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
This is because lmclient.h includes some winsock2 headers. And if you include windows.h before lmclient.h you get this problem because windows.h includes the version 1 winsock headers.
I fixed this by defining WIN32_LEAN_AND_MEAN early on so that windows.h doesn't include the winsock header. You could also include winsock2.h before windows.h.
It can be tricky to find where to do this since headers can sneak in anywhere in your translation unit and these changes might need to happen in multiple places.
I just worked through this yesterday and was about to file a bug report on this.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Thanks @raffie I have raised a bug case for this issue.
Best Regards,
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Hello guys,
thanks for answers and tips. You are right, that ws2tcpip.h include was causing problems. I did not want to edit any FlexNet headers so I fixed it using this approach:
Everytime I included lmclient.h in my code, I defined #define _WS2TCPIP_H_ which cause not to include ws2tcpip.h. This solved my issue.
Thanks.
Tomas C.