473,666 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"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:
"Applicatio ns/openCV/OpenCV.framewor k/Headers/cxtypes.h:549: error:
ISO C++ forbids declaration of 'uchar' with no type
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:549: error:
expected ';' before '*' token
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h: In function
'CvMat cvMat(int, int, int, void*)':
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:625: error:
'union CvMat::<anonymo us>' has no member named 'ptr'
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:625: error:
'uchar' was not declared in this scope
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:625: error:
expected primary-expression before ')' token
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:625: error:
expected `;' before 'data'
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h: In function
'double cvmGet(const CvMat*, int, int)':
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:654: error:
'const union CvMat::<anonymo us>' has no member named 'ptr'
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:658: error:
'const union CvMat::<anonymo us>' has no member named 'ptr'
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h: In function
'void cvmSet(CvMat*, int, int, double)':
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:671: error:
'union CvMat::<anonymo us>' has no member named 'ptr'
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:675: error:
'union CvMat::<anonymo us>' has no member named 'ptr'
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h: At global
scope:
/Applications/openCV/OpenCV.framewor k/Headers/cxtypes.h:708: error:
ISO C++ forbids declaration of 'uchar' with no type
....
...
....
any suggestion ?
Jun 29 '08 #1
8 7864
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:

"Application s/openCV/OpenCV.framewor k/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
On Jun 29, 2:52*pm, rpbg...@yahoo.c om (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:
"Applicatio ns/openCV/OpenCV.framewor k/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
On Jun 30, 1:27*am, Greg Herlihy <gre...@mac.com wrote:
On Jun 29, 2:52*pm, rpbg...@yahoo.c om (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:
>"Application s/openCV/OpenCV.framewor k/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
On Jun 30, 9:14*pm, aneuryzma <patrick.divia. ..@gmail.comwro te:
On Jun 30, 1:27*am, Greg Herlihy <gre...@mac.com wrote:
On Jun 29, 2:52*pm, rpbg...@yahoo.c om (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:
"Applicatio ns/openCV/OpenCV.framewor k/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
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
On Jun 30, 3:18*pm, aneuryzma <patrick.divia. ..@gmail.comwro te:
[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
On Jun 30, 9:58*pm, Puppet_Sock <puppet_s...@ho tmail.comwrote:
On Jun 30, 3:18*pm, aneuryzma <patrick.divia. ..@gmail.comwro te:
[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
On Jun 30, 4:19*pm, aneuryzma <patrick.divia. ..@gmail.comwro te:
[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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
9747
by: kelvSYC | last post by:
This little bit of seeminly innocent code seems to give me these two errors, all on the line that declares check(). Is there some part of C++ that I'm missing out on? class Condition { public: Condition() {} virtual ~Condition() {} virtual bool check() const;
5
7245
by: vilhelm.sjoberg | last post by:
Hello, I am a resonably confident C programmer, but not very sure about the dark corners of C++. Recently, I had G++ give me a strange error. The program in question is in essence: struct foo { };
6
10614
by: | last post by:
Hi, I'm using .Net CF, and I'm trying to load an XML document that has a first line: <?xml version="1.0" encoding="ISO-8859-1"?> I'm loading this via XmlDocument.Load(). However, I get and XmlException with no real good useful info: An unhandled exception of type 'System.Xml.XmlException' occurred in System.Xml.dll
10
20863
by: Kobu | last post by:
My question is about the use and meaning of the terms "declaration" and "definition" as it pertains to the C language. I've read sources that mix the two up when talking about such things as setting aside storage for an object, defining/declaring a struct, parts of a function, referencing an external variable in another module. sourcefile1.c ============== extern long globalfoo; /* declaration? */
5
4955
by: TJS | last post by:
trying to display pdf file in browser fails on this line: Response.ContentType = "application/pdf" getting an error about no declaration found for "response" what declaration is needed ???
12
7351
by: Mark | last post by:
In our web.config, we have changed the first line below to look like the second: OLD: <globalization requestEncoding="utf-8" responseEncoding="utf-8" /> NEW: <globalization requestEncoding="ISO-8859-1" responseEncoding="ISO-8859-1" /> What characters are we excluding from working properly and/or what problems might we encounter by making this change to our site? Practical examples would be appreciated.
4
10360
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
I do the following: StringBuilder xml = new StringBuilder(); XmlWriterSettings xws = new XmlWriterSettings(); xws.Encoding = Encoding.GetEncoding("iso-8859-1"); xws.Indent = true; XmlWriter xtw = XmlTextWriter.Create(new StringWriter(xml), xws); .... But the xml it creates has encoding="utf-16"
15
1815
by: Richard | last post by:
Can anyone recommend a good online resource listing all C keywords, standard system calls, defines etc in a "flat" hierarchy. I wish to set up some bindings in order to bring up "hints and tips" on using such keywords/functions from ISO C in an IDE I am working on. So I would bring up a function and use the current word as the search criteria to locate an online library/faq e.g
1
4022
by: jan.geek | last post by:
Hi all, When reading the following ugly but valid (according to w3c XSV) xsd into a DataSet I get "Duplicated declaration PossiblesValue" error. Can anyone tell me why? This is a small part of a large xsd reverse engineered from an existing xml output from an application so despite the structure being crap it can't be changed. Thanks,
0
8448
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8552
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1776
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.