PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > "ISO C++ forbids declaration of uchar with no type"
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
"ISO C++ forbids declaration of uchar with no type"

Réponse
 
LinkBack Outils de la discussion
Vieux 29/06/2008, 22h26   #1
aneuryzma
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut "ISO C++ forbids declaration of uchar with no type"

Hello,

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
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:549: error:
expected ';' before '*' token
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h: In function
'CvMat cvMat(int, int, int, void*)':
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:625: error:
'union CvMat::<anonymous>' has no member named 'ptr'
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:625: error:
'uchar' was not declared in this scope
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:625: error:
expected primary-expression before ')' token
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:625: error:
expected `;' before 'data'
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h: In function
'double cvmGet(const CvMat*, int, int)':
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:654: error:
'const union CvMat::<anonymous>' has no member named 'ptr'
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:658: error:
'const union CvMat::<anonymous>' has no member named 'ptr'
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h: In function
'void cvmSet(CvMat*, int, int, double)':
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:671: error:
'union CvMat::<anonymous>' has no member named 'ptr'
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:675: error:
'union CvMat::<anonymous>' has no member named 'ptr'
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h: At global
scope:
/Applications/openCV/OpenCV.framework/Headers/cxtypes.h:708: error:
ISO C++ forbids declaration of 'uchar' with no type
....
...
....


any suggestion ?
  Réponse avec citation
Vieux 29/06/2008, 22h52   #2
Roland Pibinger
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: "ISO C++ forbids declaration of uchar with no type"

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.


--
Roland Pibinger
"The best software is simple, elegant, and full of drama" - Grady Booch
  Réponse avec citation
Vieux 30/06/2008, 00h27   #3
Greg Herlihy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: "ISO C++ forbids declaration of uchar with no type"

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
  Réponse avec citation
Vieux 30/06/2008, 20h14   #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
Vieux 30/06/2008, 20h18   #5
aneuryzma
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: "ISO C++ forbids declaration of uchar with no type"

On Jun 30, 9:14pm, aneuryzma <patrick.divia...@gmail.com> wrote:
> 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


I just want to remark that everything works perfectly if I build only
the openCV application. I think there is some kind of conflict on the
uchar variable.
  Réponse avec citation
Vieux 30/06/2008, 20h42   #6
Roland Pibinger
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: "ISO C++ forbids declaration of uchar with no type"

On Mon, 30 Jun 2008 12:14:15 -0700 (PDT), aneuryzma wrote:
>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


Do you define HAVE_IPL (e.g. -DHAVE_IPL in the makefile)?

  Réponse avec citation
Vieux 30/06/2008, 20h58   #7
Puppet_Sock
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: "ISO C++ forbids declaration of uchar with no type"

On Jun 30, 3:18pm, aneuryzma <patrick.divia...@gmail.com> wrote:
[snip]
> I just want to remark that everything works perfectly if I build only
> the openCV application. I think there is some kind of conflict on the
> uchar variable.


Right.

So what you want to do now is create the smallest possible
chunk of source code that demonstrates the error.

Make a copy of the source files. "Hand" do the includes
to get down to a single file that still shows the error.

Then start the old "divide and rule." Take out half the
source code and see if the error goes away. Bin-search
on it till you get down to five or ten lines or so.
Should not take you more than 10 or 15 divides.

If the error does not become obvious this way, post back
a short example.
Socks
  Réponse avec citation
Vieux 30/06/2008, 21h19   #8
aneuryzma
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: "ISO C++ forbids declaration of uchar with no type"

On Jun 30, 9:58pm, Puppet_Sock <puppet_s...@hotmail.com> wrote:
> On Jun 30, 3:18pm, aneuryzma <patrick.divia...@gmail.com> wrote:
> [snip]
>
> > I just want to remark that everything works perfectly if I build only
> > the openCV application. I think there is some kind of conflict on the
> > uchar variable.

>
> Right.
>
> So what you want to do now is create the smallest possible
> chunk of source code that demonstrates the error.
>
> Make a copy of the source files. "Hand" do the includes
> to get down to a single file that still shows the error.
>
> Then start the old "divide and rule." Take out half the
> source code and see if the error goes away. Bin-search
> on it till you get down to five or ten lines or so.
> Should not take you more than 10 or 15 divides.
>
> If the error does not become obvious this way, post back
> a short example.
> Socks


Hi,

well, I think I solved just including openCV before and ogre3d later.

Do you know a cross-platform multithread *light* library that I can
use to run both application simultaneously ?

thanks!

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 13h31.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,20836 seconds with 16 queries