problem using Winsock2.h

Hi,

I’m having problems including the file Winsock2.h on 32-bit Windows XP with pgi 13.3 compilers. I’m sure I had this working sometime before (pgi 12.9 I think). The following trivial example:

#include <Winsock2.h>

int main() {
 return 0;
}

gives the following error:

PGC-W-0043-Redefinition of symbol, va_list (C:\PROGRA~1\PGI/win32/13.3/include\stdarg.h: 37)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword gasm (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3765)
PGC-S-0040-Illegal use of symbol, mov (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3766)
PGC-W-0156-Type not specified, 'int' assumed (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3766)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier mov by ',' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3767)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier lock by ';' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3768)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier setc by '!=' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3769)
PGC-S-0039-Use of undeclared variable bts (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3768)
PGC-S-0054-Subscript operator ([]) applied to non-array (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3768)
PGC-S-0036-Syntax error: Recovery attempted by inserting ';' before '}' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3770)
PGC-S-0039-Use of undeclared variable al (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3770)
PGC-W-0118-Function InterlockedBitTestAndSet does not contain a return statement (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3771)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword gasm (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3780)
PGC-S-0040-Illegal use of symbol, mov (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3781)
PGC-W-0156-Type not specified, 'int' assumed (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3781)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier mov by ',' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3782)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier lock by ';' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3783)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier setc by '!=' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3784)
PGC-S-0039-Use of undeclared variable btr (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3783)
PGC-S-0054-Subscript operator ([]) applied to non-array (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3783)
PGC-S-0036-Syntax error: Recovery attempted by inserting ';' before '}' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3785)
PGC-W-0118-Function InterlockedBitTestAndReset does not contain a return statement (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3786)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword gasm (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3988)
PGC-S-0040-Illegal use of symbol, xchg (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3989)
PGC-W-0156-Type not specified, 'int' assumed (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3989)
PGC-S-0036-Syntax error: Recovery attempted by inserting ';' before '}' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3990)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword gasm (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4034)
PGC-S-0040-Illegal use of symbol, mov (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4035)
PGC-W-0156-Type not specified, 'int' assumed (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4035)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier rdpmc by ';' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4036)
PGC-W-0118-Function ReadPMC does not contain a return statement (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4038)
PGC-S-0032-Syntax error: Unexpected input at identifier rdtsc (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4066)
PGC-S-0029-Syntax error: Recovery attempted by deleting from identifier rdtsc on line 4066 through '}' on line 4067 (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h)
PGC-F-0008-Error limit exceeded (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4111)
PGC/x86 Windows 13.3-0: compilation aborted

Any ideas?

Thanks,

Andy

Thanks Andy. It looks like we’re missing an ifdef around some Microsoft only code in the header file. We recently started using Open Tools 11 and is why it works with 12.9 (which used Open Tools 10). I’ve added TPR#19259 to track this issue.

As a work around you can try adding the define flag “-D_MSC_FULL_VER=140030223”. Granted, I’m not sure if it will cause other issues, but at least it will allow this one file to compile.

PGI$ pgcc -c wins.c  -V13.4 -w -m32 -D_MSC_FULL_VER=140030223
PGC/x86 Windows 13.4-0: compilation completed with warnings

Best Regards,
Mat

Mat,

Strangely this doesn’t fix everything like it does for you, although it does reduce the amount of reported problems:

pgcc -c test.c -w -m32 -D_MSC_FULL_VER=140030223
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword gasm (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3988)
PGC-S-0040-Illegal use of symbol, xchg (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3989)
PGC-S-0036-Syntax error: Recovery attempted by inserting ';' before '}' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 3990)
PGC-S-0037-Syntax error: Recovery attempted by deleting keyword gasm (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4034)
PGC-S-0040-Illegal use of symbol, mov (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4035)
PGC-S-0035-Syntax error: Recovery attempted by replacing identifier rdpmc by ';' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4036)
PGC-S-0032-Syntax error: Unexpected input at identifier rdtsc (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4066)
PGC-S-0029-Syntax error: Recovery attempted by deleting from identifier rdtsc on line 4066 through '}' on line 4067 (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h)
PGC-S-0035-Syntax error: Recovery attempted by replacing '{' by ';' (C:\PROGRA~1\PGI/win32/13.3/include\WinNT10.h: 4095)
PGC/x86 Windows 13.3-0: compilation completed with severe errors

This isn’t a major problem right now, since I’ve plenty of other things to fix for our Windows port and I can just comment the code which needs Winsock2.h at the moment.

Thanks,

Andy

Andy,

TPR 19259 32-bit Windows C/C++
Compilation errors occur with winnt11.h on 32-bit Windows Corrected the syntax of the __asm statements in winnt11.h

has been fixed in 13.5. Thanks for reporting.

dave