Missing new.h and broken comdef.h in cygwin32-w32api-headers (and the mingw header packages too)

Hans de Ruiter hans@keasigmadelta.com
Tue Apr 7 13:29:59 GMT 2020


I've been trying to compile something that uses comutil.h, which in turn 
includes comip.h and comdef.h (amongst others).

First, I get a missing header error:
/usr/include/w32api/comip.h:21:10: fatal error: new.h: No such file or 
directory

So, I copy new.h from the mingw headers (I'm using the cygwin compiler 
*not* mingw). Then, I get the following:

/licensingclient/src/client/Licensing/hwid.cpp.o 
ThirdParty/licensingclient/src/client/Licensing/hwid.cpp
In file included from 
ThirdParty/licensingclient/src/client/Licensing/wmihelper.h:8,
                  from 
ThirdParty/licensingclient/src/client/Licensing/hwid.cpp:13:
/usr/include/w32api/comutil.h:412:3: error: 
'_variant_t::_variant_t(unsigned int)' cannot be overloaded with 
'_variant_t::_variant_t(unsigned int)'
   412 |   _variant_t(unsigned int uiSrc) throw();
       |   ^~~~~~~~~~
/usr/include/w32api/comutil.h:410:3: note: previous declaration 
'_variant_t::_variant_t(unsigned int)'
   410 |   _variant_t(unsigned __LONG32 ulSrc) throw();
       |   ^~~~~~~~~~
/usr/include/w32api/comutil.h:431:3: error: '_variant_t::operator int() 
const' cannot be overloaded with '_variant_t::operator int() const'
   431 |   operator int() const;
       |   ^~~~~~~~
/usr/include/w32api/comutil.h:417:3: note: previous declaration 
'_variant_t::operator int() const'
   417 |   operator __LONG32() const;
       |   ^~~~~~~~
/usr/include/w32api/comutil.h:432:3: error: '_variant_t::operator 
unsigned int() const' cannot be overloaded with '_variant_t::operator 
unsigned int() const'
   432 |   operator unsigned int() const;
       |   ^~~~~~~~
/usr/include/w32api/comutil.h:430:3: note: previous declaration 
'_variant_t::operator unsigned int() const'
   430 |   operator unsigned __LONG32() const;
       |   ^~~~~~~~
/usr/include/w32api/comutil.h:454:15: error: '_variant_t& 
_variant_t::operator=(int)' cannot be overloaded with '_variant_t& 
_variant_t::operator=(int)'
   454 |   _variant_t &operator=(int iSrc);
       |               ^~~~~~~~
/usr/include/w32api/comutil.h:439:15: note: previous declaration 
'_variant_t& _variant_t::operator=(int)'
   439 |   _variant_t &operator=(__LONG32 lSrc);
       |               ^~~~~~~~
/usr/include/w32api/comutil.h:455:15: error: '_variant_t& 
_variant_t::operator=(unsigned int)' cannot be overloaded with 
'_variant_t& _variant_t::operator=(unsigned int)'
   455 |   _variant_t &operator=(unsigned int uiSrc);
       |               ^~~~~~~~
/usr/include/w32api/comutil.h:453:15: note: previous declaration 
'_variant_t& _variant_t::operator=(unsigned int)'
   453 |   _variant_t &operator=(unsigned __LONG32 ulSrc);
       |               ^~~~~~~~
/usr/include/w32api/comutil.h:603:8: error: redefinition of 
'_variant_t::_variant_t(unsigned int)'
   603 | inline _variant_t::_variant_t(unsigned int uiSrc) throw() {
       |        ^~~~~~~~~~
/usr/include/w32api/comutil.h:595:8: note: 
'_variant_t::_variant_t(unsigned int)' previously defined here
   595 | inline _variant_t::_variant_t(unsigned __LONG32 ulSrc) throw() {
       |        ^~~~~~~~~~
/usr/include/w32api/comutil.h:716:8: error: redefinition of 
'_variant_t::operator int() const'
   716 | inline _variant_t::operator int() const {
       |        ^~~~~~~~~~
/usr/include/w32api/comutil.h:621:8: note: '_variant_t::operator int() 
const' previously defined here
   621 | inline _variant_t::operator __LONG32() const {
       |        ^~~~~~~~~~
/usr/include/w32api/comutil.h:722:8: error: redefinition of 
'_variant_t::operator unsigned int() const'
   722 | inline _variant_t::operator unsigned int() const {
       |        ^~~~~~~~~~
/usr/include/w32api/comutil.h:710:8: note: '_variant_t::operator 
unsigned int() const' previously defined here
   710 | inline _variant_t::operator unsigned __LONG32() const {
       |        ^~~~~~~~~~
/usr/include/w32api/comutil.h:990:20: error: redefinition of 
'_variant_t& _variant_t::operator=(int)'
   990 | inline _variant_t &_variant_t::operator=(int iSrc)
       |                    ^~~~~~~~~~
/usr/include/w32api/comutil.h:763:20: note: '_variant_t& 
_variant_t::operator=(int)' previously defined here
   763 | inline _variant_t &_variant_t::operator=(__LONG32 lSrc) {
       |                    ^~~~~~~~~~
/usr/include/w32api/comutil.h:1004:20: error: redefinition of 
'_variant_t& _variant_t::operator=(unsigned int)'
  1004 | inline _variant_t &_variant_t::operator=(unsigned int uiSrc)
       |                    ^~~~~~~~~~
/usr/include/w32api/comutil.h:976:20: note: '_variant_t& 
_variant_t::operator=(unsigned int)' previously defined here
   976 | inline _variant_t &_variant_t::operator=(unsigned __LONG32 ulSrc)
       |                    ^~~~~~~~~~
In file included from 
ThirdParty/licensingclient/src/client/Licensing/wmihelper.h:8,
                  from 
ThirdParty/licensingclient/src/client/Licensing/hwid.cpp:13:
/usr/include/w32api/comdef.h: In member function 'const TCHAR* 
_com_error::ErrorMessage() const':
/usr/include/w32api/comdef.h:143:4: error: 'sprintf_s' was not declared 
in this scope; did you mean '_sprintf_r'?
   143 |    _COM_PRINTF_S_1(m_pszMsg,32,TEXT("IDispatch error #%d"),wCode);
       |    ^~~~~~~~~~~~~~~
/usr/include/w32api/comdef.h:145:4: error: 'sprintf_s' was not declared 
in this scope; did you mean '_sprintf_r'?
   145 |    _COM_PRINTF_S_1(m_pszMsg,32,TEXT("Unknown error 
0x%0lX"),m_hresult);
       |    ^~~~~~~~~~~~~~~
make: *** [Makefile:182: 
build/Windows_NT/debug/ThirdParty/licensingclient/src/client/Licensing/hwid.cpp.o] 
Error 1
====12 errors, 10 warnings====

I tried simply using the mingw headers entirely, and I still get the 
errors above.

This is with:
- gcc 9.3.0 with -std=gnu++2a in the command line, although it also 
happens when -std is set to other C++ standard versions (e.g., 
-std=gnu++11).
- cygwin32-w32api-headers 4.0.4-1
- MinGW headers from mingw64-x86_64-headers 7.0.0-1

regards,
Hans


-- 
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the Cygwin mailing list