469,277 Members | 2,405 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,277 developers. It's quick & easy.

Problem with VC++ compiler

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.

Feb 19 '07 #1
4 1626
tf*****@gmail.com 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.
Feb 19 '07 #2
"jacob navia" <ja***@jacob.remcomp.frwrote in message
news:45**********************@news.orange.fr...
tf*****@gmail.com 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.
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
Feb 19 '07 #3
P.J. Plauger a écrit :
"jacob navia" <ja***@jacob.remcomp.frwrote in message
news:45**********************@news.orange.fr...

>>tf*****@gmail.com 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.


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".

Feb 19 '07 #4
tf*****@gmail.com wrote:
>
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
Feb 20 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

14 posts views Thread by Bo | last post: by
5 posts views Thread by Mark | last post: by
3 posts views Thread by debadeepti | last post: by
13 posts views Thread by john.constantine | last post: by
3 posts views Thread by Rene | last post: by
19 posts views Thread by foolsmart2005 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.