dimanche 20 septembre 2020

Improper use of typedef

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?

Aucun commentaire:

Enregistrer un commentaire