Problem with VC++ compiler

T

tfawcet

I am having a problem with the Visual C++ compiler with the following
error

c:\rgb.h(7) : error C2371: 'pix_t' : redefinition; different basic
types

This refers to a typedef that I have written in the code. The code
will compile with the GNU compiler and I was trying to port it to VC+
+. Here is the typedef as it appears

typedef struct {
double red;
double green;
double blue;
}pix_t;

Any help would be appreciated. Thanks.
 
J

jacob navia

(e-mail address removed) a écrit :
I am having a problem with the Visual C++ compiler with the following
error

c:\rgb.h(7) : error C2371: 'pix_t' : redefinition; different basic
types

This refers to a typedef that I have written in the code. The code
will compile with the GNU compiler and I was trying to port it to VC+
+. Here is the typedef as it appears

typedef struct {
double red;
double green;
double blue;
}pix_t;

Any help would be appreciated. Thanks.

The error message says
"redefinition"

This means that pix_t is ALREADY defined, and that the new definition
is different than the first one.

Another possibility is that "red" or another identifier is already
defined as some macro. I would first try to get the output of the
preprocessor (cl -E) then look at the code to see if there is something
wrong with the definition.
 
P

P.J. Plauger

(e-mail address removed) a écrit :

The error message says
"redefinition"

This means that pix_t is ALREADY defined, and that the new definition
is different than the first one.

Another possibility is that "red" or another identifier is already
defined as some macro. I would first try to get the output of the
preprocessor (cl -E) then look at the code to see if there is something
wrong with the definition.

Good suggestion, except that the flag for VC++ is /P not -E. Look for
the *.i file of the same name as your *.c file.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
J

jacob navia

P.J. Plauger a écrit :
Good suggestion, except that the flag for VC++ is /P not -E. Look for
the *.i file of the same name as your *.c file.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com

Well, /E is for preprocessing to stdout, /P is to preprocess to a file.
Yes, probably /P is better since it creates an intermediate file. I am
used to do

cl /E foo.c >ww

then I edit ww.

Because always all my temporary files like that are called "ww".
 
C

CBFalconer

I am having a problem with the Visual C++ compiler with the
following error

c:\rgb.h(7) : error C2371: 'pix_t' : redefinition; different
basic types

This refers to a typedef that I have written in the code. The
code will compile with the GNU compiler and I was trying to port
it to VC++. Here is the typedef as it appears

typedef struct {
double red;
double green;
double blue;
}pix_t;

Any help would be appreciated. Thanks.

OWooo, Shazam, Mxysplk. The crystal ball clears and says "The
error is in line 42".

--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>

"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,216
Latest member
topweb3twitterchannels

Latest Threads

Top