Pelles C forum

Pelles C => Bug reports => Topic started by: John Z on May 01, 2025, 05:04:37 PM

Title: ocidl.h
Post by: John Z on May 01, 2025, 05:04:37 PM
Hi,

Has anyone tried using ocidl.h in release V13?

A program I just complied in V12 then switched over to use 13 shows numerous errors related to ocidl.h

Building main.obj.
C:\Program Files\PellesC_V13\Include\Win\ocidl.h(25): error #2158: Unrecognized type 'interface' (did you mean: ?).
C:\Program Files\PellesC_V13\Include\Win\ocidl.h(25): error #2001: Syntax error: expected ';' but found 'IEnumConnections'.
C:\Program Files\PellesC_V13\Include\Win\ocidl.h(25): warning #2099: Missing type specifier; assuming 'int'.
C:\Program Files\PellesC_V13\Include\Win\ocidl.h(25): error #2119: Redeclaration of 'IEnumConnections', previously declared at C:\Program Files\PellesC_V13\Include\Win\ocidl.h(25).

..... many many more similar lines then the final nail

C:\Program Files\PellesC_V13\Include\Win\ocidl.h(190): fatal error #2210: More than 100 errors, please improve yourself.

*** Error code: 1 ***


V12 no problem all on same computer all WIN 11 23H2, didn't change any code between compiles.

John Z

Re-installed V13 RC2 still same errors -
Title: Re: ocidl.h
Post by: Quin on May 01, 2025, 05:25:12 PM
Can reproduce, V12 works fine, V13 breaks.
Windows 10 21H2 and Windows 11 23H2.
Title: Re: ocidl.h
Post by: TimoVJL on May 01, 2025, 05:36:04 PM
https://forum.pellesc.de/index.php?msg=41081 (https://forum.pellesc.de/index.php?msg=41081)
Title: Re: ocidl.h
Post by: John Z on May 01, 2025, 05:47:52 PM
Hi TimoVJL,

Does this mean the same root cause for the error, or is just pointing out another issue with ocidl.h?

I could not relate the information from that one with this one ....

Thanks,

John Z
Title: Re: ocidl.h
Post by: TimoVJL on May 01, 2025, 06:07:48 PM
Not related.

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <ole2.h>
#include <ocidl.h>
This works too#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <combaseapi.h>
#include <ocidl.h>
Title: Re: ocidl.h
Post by: John Z on May 01, 2025, 10:08:53 PM
Ok - so maybe some interaction -

Here is the lead in to ocidl.h giving the errors in my situation

//#define Zdebug
#define WIN32_LEAN_AND_MEAN

#define UNICODE
#define _UNICODE

#include <windows.h>
#include <windowsx.h>
#include <wchar.h>
#include <commctrl.h>
#include <commdlg.h>
#include <tchar.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <winuser.h>         //for context sensitive help
#include <htmlhelp.h>        //for .chm help files
#include <shellapi.h>        //for web browser init
#include <ocidl.h>


John Z
Title: Re: ocidl.h
Post by: John Z on May 02, 2025, 01:20:03 AM
Removed all preceding #defines until windows.h, still shows the same issue 

Seems to be choking on each of these statements in ocidl.h

typedef interface IEnumConnections IEnumConnections;

Also tried each C compiler option 11,17,23,99 (99 is original)  No change

found #define interface  struct in basetyps.h

changed line 25 in ocidl.h to

typedef struct IEnumConnections IEnumConnections;  in line 25 only

Compiled again - Line 25 did not show in the error list anymore.

I don't know what calls basetyps.h but I see ocidl.h does not - - -
I couldn't find any .h that calls basetype.h
I did find this statement /* see basetyps.h (and then just give up) */ in combaseapi.h

I hope this helps someone I don't know what it means if anything other than 'interface' must not be being defined as 'struct' AFAIK

John Z
Title: Re: ocidl.h
Post by: TimoVJL on May 02, 2025, 05:56:46 AM
If you use WIN32_LEAN_AND_MEAN
you have to add ole2.h or combaseapi.h

Then it works, as expected.
Title: Re: ocidl.h
Post by: Michele on May 02, 2025, 09:21:15 AM
Maybe that the problem is simply the missing definition of interface?
That's why prepending the include of an header that defines it remove the problem.
Maybe in this compiler version ocidl.h is buggy?
Title: Re: ocidl.h
Post by: TimoVJL on May 02, 2025, 09:49:31 AM
ocidl.h, only missing safeguard like this#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
Title: Re: ocidl.h
Post by: John Z on May 02, 2025, 10:23:08 AM
Thanks TimoVJL - these workarounds do work -

However when the same code is compiled in Version 12 there is no need to add or change anything.
It just works -

Quote from: TimoVJL on May 02, 2025, 05:56:46 AMIf you use WIN32_LEAN_AND_MEAN
you have to add ole2.h or combaseapi.h

So yes, the above does work, but why different than version 12 which does not require extra includes?

John Z
Title: Re: ocidl.h
Post by: TimoVJL on May 02, 2025, 11:23:37 AM
Because v12 ocidl.h have that safeguard, that add ole2.h
It have to add to v13 ocidl.h too.
Title: Re: ocidl.h
Post by: John Z on May 02, 2025, 12:34:35 PM
Quote from: TimoVJL on May 02, 2025, 11:23:37 AMBecause v12 ocidl.h have that safeguard, that add ole2.h
It have to add to v13 ocidl.h too.
👍👍👍

Got it I'll do it!

Thanks!

John Z