If a project using socket functions and a little bit more is to be compiled for Windows 7, I get errors.
Apparently the type (structure) NDIS_OBJECT_HEADER is declared later as the first use. In order to compile the project, there is a work around (for me), but this is not the correct way:
#ifdef __POCC__
#define _NETIOAPI_H
#endif
The following code allows to reproduce the problem:
------------------------------------------------------------
// file bug.c
#define _WIN32_WINNT 0x0601
#include <stdio.h>
#include <stdlib.h>
//#include <windows.h> // Error
// PellesC\Include\Win\windot11.h(24): error #2078: Invalid struct field declarations.
// PellesC\Include\Win\windot11.h(24): error #2001: Syntax error: expected '}' but found 'NDIS_OBJECT_HEADER'.
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iphlpapi.h> // Error as for windows.h
int __cdecl main(void)
{
printf("Hello\n");
return 0;
}
-----------------------------------------------------------
The hand made Makefile look as follows:
----------------------------------------------------------
INCLUDE = -I"$(PellesCDir)\Include\Win" -I"$(PellesCDir)\Include"
LIB = /LIBPATH:"$(PellesCDir)\Lib\Win" /LIBPATH:"$(PellesCDir)\Lib"
CFLAGS = /std:C99 -Tx86-coff /Ot /Ob1 /fp:precise /W1 /Gz /Ze $(INCLUDE)
LDFLAGS = /subsystem:console /machine:x86 $(LIB) kernel32.lib user32.lib wsock32.lib ws2_32.lib iphlpapi.lib
ASFLAGS = -AIA32 -Gz
LINK=polink
CC=pocc
bug.exe: bug.obj
$(LINK) $(LDFLAGS) /out:bug.exe bug.obj
bug.obj: bug.c
$(CC) $(CFLAGS) bug.c /Fo bug.obj
clean:
del bug.obj bug.exe
----------------------------------------------------------