Re: [Mingw-w64-public] strsafe.h cannot be included before windows.h

2024-02-18 Thread LIU Hao

在 2024-02-18 15:40, Julian Waters 写道:

In file included from C:/msys64/ucrt64/include/windows.h:70,
  from try.c:4:
C:/msys64/ucrt64/include/winbase.h:1499:37: error: expected identifier
or '(' before 'LPSTR'
  1499 |   WINBASEAPI LPSTR WINAPI lstrcpyA (LPSTR lpString1, LPCSTR lpString2);
   | ^


This file can be pre-processed with `gcc -E -dD`; and this line actually becomes

__attribute__((dllimport)) LPSTR __attribute__((__stdcall__))
lstrcpyA_instead_use_StringCbCopyA_or_StringCchCopyA; (LPSTR lpString1,
LPCSTR lpString2);

which is due to this macro in :

   #define lstrcpyA lstrcpyA_instead_use_StringCbCopyA_or_StringCchCopyA;


These macros have been moved from  to  since Windows SDK 8.0. Maybe we should 
do the same.



--
Best regards,
LIU Hao



OpenPGP_signature.asc
Description: OpenPGP digital signature
___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public


[Mingw-w64-public] strsafe.h cannot be included before windows.h

2024-02-17 Thread Julian Waters
Tried with gcc 13:

gcc -O3 -flto=auto -std=c11 -pedantic -Wpedantic -Wall -Wextra try.c

#include 

#include 
#include 

int main() {
return 0;
}

In file included from C:/msys64/ucrt64/include/windows.h:70,
 from try.c:4:
C:/msys64/ucrt64/include/winbase.h:1499:37: error: expected identifier
or '(' before 'LPSTR'
 1499 |   WINBASEAPI LPSTR WINAPI lstrcpyA (LPSTR lpString1, LPCSTR lpString2);
  | ^
C:/msys64/ucrt64/include/winbase.h:1500:38: error: expected identifier
or '(' before 'LPWSTR'
 1500 |   WINBASEAPI LPWSTR WINAPI lstrcpyW (LPWSTR lpString1, LPCWSTR
lpString2);
  |  ^~
C:/msys64/ucrt64/include/winbase.h:1501:37: error: expected identifier
or '(' before 'LPSTR'
 1501 |   WINBASEAPI LPSTR WINAPI lstrcatA (LPSTR lpString1, LPCSTR lpString2);
  | ^
C:/msys64/ucrt64/include/winbase.h:1502:38: error: expected identifier
or '(' before 'LPWSTR'
 1502 |   WINBASEAPI LPWSTR WINAPI lstrcatW (LPWSTR lpString1, LPCWSTR
lpString2);
  |  ^~
In file included from C:/msys64/ucrt64/include/windows.h:72:
C:/msys64/ucrt64/include/winuser.h:168:36: error: expected identifier
or '(' before 'LPSTR'
  168 |   WINUSERAPI int WINAPI wvsprintfA(LPSTR,LPCSTR,va_list arglist);
  |^
C:/msys64/ucrt64/include/winuser.h:169:36: error: expected identifier
or '(' before 'LPWSTR'
  169 |   WINUSERAPI int WINAPI wvsprintfW(LPWSTR,LPCWSTR,va_list arglist);
  |^~
C:/msys64/ucrt64/include/winuser.h:170:36: error: expected identifier
or '(' before 'LPSTR'
  170 |   WINUSERAPI int WINAPIV wsprintfA(LPSTR,LPCSTR,...);
  |^
C:/msys64/ucrt64/include/winuser.h:171:36: error: expected identifier
or '(' before 'LPWSTR'
  171 |   WINUSERAPI int WINAPIV wsprintfW(LPWSTR,LPCWSTR,...);
  |^~
In file included from try.c:3:
C:/msys64/ucrt64/include/stralign.h: In function 'ua_wcscpy':
C:/msys64/ucrt64/include/stralign.h:141:14: error:
'wcscpy_instead_use_StringCbCopyW_or_StringCchCopyW' undeclared (first
use in this function); did you mean
'lstrcpyW_instead_use_StringCbCopyW_or_StringCchCopyW'?
  141 |   return wcscpy((PWSTR)Destination,(PCWSTR)Source);
  |  ^~
C:/msys64/ucrt64/include/stralign.h:141:14: note: each undeclared
identifier is reported only once for each function it appears in

best regards,
Julian


___
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public