News:

Download Pelles C here: http://www.smorgasbordet.com/pellesc/

Main Menu

ocidl.h

Started by John Z, May 01, 2025, 05:04:37 PM

Previous topic - Next topic

John Z

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 -

Quin

Can reproduce, V12 works fine, V13 breaks.
Windows 10 21H2 and Windows 11 23H2.
Use the assembly, Luke.

TimoVJL

May the source be with you

John Z

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

TimoVJL

#4
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>
May the source be with you

John Z

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

John Z

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

TimoVJL

#7
If you use WIN32_LEAN_AND_MEAN
you have to add ole2.h or combaseapi.h

Then it works, as expected.
May the source be with you

Michele

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?

TimoVJL

#9
ocidl.h, only missing safeguard like this#ifndef COM_NO_WINDOWS_H
#include "windows.h"
#include "ole2.h"
#endif /*COM_NO_WINDOWS_H*/
May the source be with you

John Z

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

TimoVJL

Because v12 ocidl.h have that safeguard, that add ole2.h
It have to add to v13 ocidl.h too.
May the source be with you

John Z

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