Reputation: 54
I am using C++ compiler Embarcadero under Windows OS.
This code must be without error, but I am receiving this error message:
Improper use of typedef 'pt'
typedef struct{
AnsiString x, y;
}pt;
pt zero(void){
return (pt){
INFINITY, INFINITY
};
}
I search online and I read in Embarcadero website:
Your source file used a typedef symbol where a variable should appear in an expression. Check for the declaration of the symbol and possible misspellings.
yet in my idea, it's correct, although I was guessing maybe pt is somehow reserved, I change the variable name to bbkpt, still the same error.
The code above is defined globally.
Any idea how to fix it if it is not right?
Upvotes: 0
Views: 1620
Reputation: 223091
Compound literals are a C feature not in standard C++ yet. The C++ compiler you are using does not support them, at least not with the settings you are using.
Upvotes: 3