Reputation: 21
Im supposed to write a C++-programm that interacts with a uEye camera. For this I have to include several files, one of them being a header file that has around 30 interfaces in it that are like the one shown below. When I run a c++ programm including this header file, Im getting the error:
"error: expected identifier or '(' before ':' token"
at the first line (interface IuEyeAutoFeatures : public IUnknown) of every single interface in the header file.
Heres one of the interfaces from the header file:
interface IuEyeAutoFeatures : public IUnknown
{
STDMETHOD(SetAutoBrightnessReference)(long lReference) = 0;
STDMETHOD(GetAutoBrightnessReference)(long* plReference) = 0;
STDMETHOD(SetAutoBrightnessMaxExposure)(long lMaxExposure) = 0;
STDMETHOD(GetAutoBrightnessMaxExposure)(long* plMaxExposure) = 0;
STDMETHOD(SetAutoBrightnessMaxGain)(long lMaxGain) = 0;
STDMETHOD(GetAutoBrightnessMaxGain)(long* plMaxGain) = 0;
STDMETHOD(SetAutoBrightnessSpeed)(long lSpeed) = 0;
STDMETHOD(GetAutoBrightnessSpeed)(long* plSpeed) = 0;
STDMETHOD(SetAutoBrightnessAOI)(long lXPos, long lYPos, long lWidth, long lHeight) = 0;
STDMETHOD(GetAutoBrightnessAOI)(long* plXPos, long* plYPos, long* plWidth, long* plHeight) = 0;
STDMETHOD(SetAutoWBGainOffsets)(long lRedOffset, long lBlueOffset) = 0;
STDMETHOD(GetAutoWBGainOffsets)(long* plRedOffset, long* plBlueOffset) = 0;
STDMETHOD(SetAutoWBGainRange)(long lMinRGBGain, long lMaxRGBGain) = 0;
STDMETHOD(GetAutoWBGainRange)(long* plMinRGBGain, long* plMaxRGBGain) = 0;
STDMETHOD(SetAutoWBSpeed)(long lSpeed) = 0;
STDMETHOD(GetAutoWBSpeed)(long* plSpeed) = 0;
STDMETHOD(SetAutoWBAOI)(long lXPos, long lYPos, long lWidth, long lHeight) = 0;
STDMETHOD(GetAutoWBAOI)(long* plXPos, long* plYPos, long* plWidth, long* plHeight) = 0;
};
DEFINE_GUID(IID_IuEyeFaceDetection,
0xe122a994, 0xfc4d, 0x445b, 0xb2, 0x1c, 0x30, 0x8b, 0x67, 0x48, 0x44, 0xe0);
#ifndef DS_EXPORT
# define DS_EXPORT
# ifdef _UEYETIME
# undef _UEYETIME
# endif
# ifdef UEYETIME
# undef UEYETIME
# endif
typedef struct _UEYETIME
{
WORD wYear;
WORD wMonth;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
BYTE byReserved[10];
} UEYETIME;
#endif /* DS_EXPORT */
#ifndef DS_EXPORT
# define DS_EXPORT
# ifdef S_FDT_INFO_EL
# undef S_FDT_INFO_EL
# endif
# ifdef FDT_INFO_EL
# undef FDT_INFO_EL
# endif
/*!
* \brief uEye face detection info element data type.
* Info on a single detected face as listed by \see FDT_INFO_LIST.
*/
typedef struct S_FDT_INFO_EL
{
INT nFacePosX; /*!< \brief Start X position. */
INT nFacePosY; /*!< \brief Start Y position. */
INT nFaceWidth; /*!< \brief Face width. */
INT nFaceHeight; /*!< \brief Face height. */
INT nAngle; /*!< \brief Face Angle (0...360° clockwise, 0° at twelve o'clock position. -1: undefined ). */
UINT nPosture; /*!< \brief Face posture. */
UEYETIME TimestampSystem; /*!< \brief System time stamp (device query time) . */
UINT64 nReserved; /*!< \brief Reserved for future use. */
UINT nReserved2[4]; /*!< \brief Reserved for future use. */
} FDT_INFO_EL;
#endif /* DS_EXPORT */
#ifndef DS_EXPORT
# define DS_EXPORT
# ifdef S_FDT_INFO_LIST
# undef S_FDT_INFO_LIST
# endif
# ifdef FDT_INFO_LIST
# undef FDT_INFO_LIST
# endif
/*!
* \brief uEye face detection info list data type.
* List of detected faces, lists \see FDT_INFO_EL objects.
*/
typedef struct S_FDT_INFO_LIST
{
UINT nSizeOfListEntry; /*!< \brief Size of one list entry in byte(in). */
UINT nNumDetectedFaces; /*!< \brief Number of detected faces(out). */
UINT nNumListElements; /*!< \brief Number of list elements(in). */
UINT nReserved[4]; /*!< \brief reserved for future use(out). */
FDT_INFO_EL FaceEntry[1]; /*!< \brief First face entry. */
} FDT_INFO_LIST;
#endif /* DS_EXPORT */
As far as I know, declaring interfaces using the word "interface" is done in languages like Java but not in c++, so I dont understand why this header file declares interfaces like this. Since this header file is provided by the company IDS after downloading their driver it should be correct i suppose.
How can I fix that bug and make my program work?
Thanks in advance
Upvotes: 2
Views: 873
Reputation: 51413
interface
is a preprocessor macro, commonly used with COM interfaces. It is defined in combaseapi.h as:
#define __STRUCT__ struct
#define interface __STRUCT__
You need to include that header file (either directly or indirectly through #include <objbase.h>
) before including the interface header.
Upvotes: 2