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

Problem with VC++ compiler

P: n/a
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
Share this Question
Share on Google+
4 Replies


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

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

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