在 2022/12/21 13:05, Biswapriyo Nath 写道:
In various headers, the name 'interface' is a macro which is defined
to 'struct' keyword. But that causes problem in code where 'interface'
is used as a variable name. Here are the list of headers in mingw-w64



The `interface` macro is used to make declarations of abstract classes more descriptive, and has the same effect as `struct`.


And there is the same error if your example is compiled with the Microsoft 
compiler:

   ```
   E:\lh_mouse\Desktop>cl test.c
   Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933 for x64
   Copyright (C) Microsoft Corporation.  All rights reserved.

   test.c
   test.c(4): error C2236: unexpected token 'struct'. Did you forget a ';'?
   test.c(4): error C2332: 'struct': missing tag name
   test.c(4): error C2513: '': no variable declared before '='
   ```


If you define `WIN32_LEAN_AND_MEAN` (either `#define` it or pass `-DWIN32_LEAN_AND_MEAN` to GCC) before inclusion of <windows.h>, then the error will go away. This seems to be yet another reason why `WIN32_LEAN_AND_MEAN` should be preferred.


--
Best regards,
LIU Hao

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

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

Reply via email to