Error: previously defined in... WHERE??? (CW10.x)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Error: previously defined in... WHERE??? (CW10.x)

1,064 Views
FridgeFreezer
Senior Contributor I

While tracking down a problem in my project, I hit compile and got a stream of errors from all sorts of places claiming all sorts of things were "previously defined in", but with NO indication what is previously defined or where CW thinks it was defined.

 

This is by no means a new trait of CW, but this flurry of errors has pushed me to post about it.

 

Presumably the compiler must have *some* clue where it last saw a declaration or definition?

 

 

It also doesn't give any sort of indication which part of a declaration has upset it, for example it's upset about this line:

char WReadSRec(struct sys_struct *sys, char *str)

 But doesn't tell me if the function or structure is the problem.

 

This makes finding the root cause much more of a hunt than it need be.

 

Note: As it turned out a mangled typedef was at fault, hence why it knocked on multiple files, but very hard to tell that from the stream of errors spewing forth.

Labels (1)
0 Kudos
4 Replies

537 Views
CrasyCat
Specialist III

Hello

 

    Did you check the Console view after a build?

    You will see more details about the problem in the Console view than in the Problems view.

 

CrasyCat

0 Kudos

537 Views
FridgeFreezer
Senior Contributor I

Console says the same thing: "Previously defined in"

0 Kudos

537 Views
Leong
Contributor III

this kind of compiler error most frequently happens when you have nested header file includes. basically you have a foo.c file that includes a header file (foo.h), this header includes another header (bar.h) from another module, at the same time, the other module has a header file (bar.h) to include the foo.h thus the compiler is confused in the chiken egg situation. The inclusion may be very deep so be careful.

 

Another possibility is that you forgot the header guard in one of the header files #ifdef _FOO_H_ #define _FOO_H_ #endif.

0 Kudos

537 Views
CrasyCat
Specialist III

Hello

 

I would recommend you to submit a service request for that.

Click here to submit a service request.

Make sure to attach a reproducible project and installed product information to the service request.

CrasyCat

0 Kudos