By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,494 Members | 1,079 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,494 IT Pros & Developers. It's quick & easy.

"ISO C++ forbids declaration of uchar with no type"

P: n/a
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 ?
Jun 29 '08 #1
Share this Question
Share on Google+
8 Replies


P: n/a
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
Jun 29 '08 #2

P: n/a
On Jun 29, 2:52*pm, 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
Jun 29 '08 #3

P: n/a
On Jun 30, 1:27*am, Greg Herlihy <gre...@mac.comwrote:
On Jun 29, 2:52*pm, 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
Jun 30 '08 #4

P: n/a
On Jun 30, 9:14*pm, aneuryzma <patrick.divia...@gmail.comwrote:
On Jun 30, 1:27*am, Greg Herlihy <gre...@mac.comwrote:
On Jun 29, 2:52*pm, 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.
Jun 30 '08 #5

P: n/a
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)?

Jun 30 '08 #6

P: n/a
On Jun 30, 3:18*pm, aneuryzma <patrick.divia...@gmail.comwrote:
[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
Jun 30 '08 #7

P: n/a
On Jun 30, 9:58*pm, Puppet_Sock <puppet_s...@hotmail.comwrote:
On Jun 30, 3:18*pm, aneuryzma <patrick.divia...@gmail.comwrote:
[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!

Jun 30 '08 #8

P: n/a
On Jun 30, 4:19*pm, aneuryzma <patrick.divia...@gmail.comwrote:
[snip]
Do you know a cross-platform multithread *light* library that I can
use to run both application simultaneously ?
Not on this news group I don't.
Socks
Jul 2 '08 #9

This discussion thread is closed

Replies have been disabled for this discussion.