Invalid structure redefinition G0505 "PV"

User ForumInvalid structure redefinition G0505 "PV"
kmhlmj2 asked 3 years ago

I encountered the followong error messages: Invalid structure redefinition G0505 "PV" and  Invalid structure redefinition G0505 "DS".

Please tell me what I should check when I see them?

Thanks in advance.


1 Answers
aptech Staff answered 3 years ago

The invalid redefinition error typically comes up when you define a variable to be a structure and then later define it to be a different type of structure. For example:

//Create an instance of a PV struct called 'mypv'
struct PV mypv;

//Attempt to redefine 'mypv' as an instance of a DS struct
struct DS mypv;

This above is essentially what is happening whenever you get this error.
One of the most common ways that this comes up is from running different files. If program 'A' defines 'mystruct' to be a struct of type 'PV' and then program 'B' defines 'mystruct' to be a struct of type 'DS', then you will get this error if you first run program 'A' and then run program 'B'. Placing:


at the top of each program will prevent this case, because new clears all variables from the GAUSS workspace.

If the structures are being redefined in the same program, then you need to come up with some more variable names.