Afficher un message
Vieux 30/06/2008, 21h14   #4
aneuryzma
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: "ISO C++ forbids declaration of uchar with no type"

On Jun 30, 1:27am, Greg Herlihy <gre...@mac.com> wrote:
> On Jun 29, 2:52pm, rpbg...@yahoo.com (Roland Pibinger) wrote:
>
> > On Sun, 29 Jun 2008 14:26:57 -0700 (PDT), aneuryzma wrote:
> > >I'm merging an OpenCV app with an Ogre3d app. I'm on a mac, I'm using
> > >xCode.

>
> > >When I add #include "openCVApp.h"

>
> > >I got the following error:

>
> > >"Applications/openCV/OpenCV.framework/Headers/cxtypes.h:549: error:
> > >ISO C++ forbids declaration of 'uchar' with no type

>
> > include the header that defines 'uchar' before openCVApp.h.

>
> Or, if no such header can be found, define the "uchar" typedef
> yourself - before including openCVApp.h:
>
> typedef unsigned char uchar;
> // ...
> #include "openCVApp.h"
>
> Even if the header with the "uchar" typedef is eventually found and
> included - having an extra "uchar" typedef in the same translation
> unit should not be a problem. A C++ program is free to define the same
> typedef, multiple times within a single scope - provided that the
> typedef is defined the same way each time.
>
> Greg


Hi,

well I tried to add typedef unsigned char uchar; before but I still
have the same error.

The thing is that "typedef unsigned char uchar;" *IS* in a header file
in which i got the error. I don't understand why the compiler
complains that it is not defined.

This is the header:

#ifndef _CXCORE_TYPES_H_
#define _CXCORE_TYPES_H_

...

#ifndef HAVE_IPL
typedef unsigned char uchar;
typedef unsigned short ushort;
#endif

...

union
{
uchar* ptr; <-- error
short* s;
int* i;
float* fl;
double* db;
}

I also tried to remove the if condition before typedef but still have
the same error
  Réponse avec citation
 
Page generated in 0,05956 seconds with 9 queries