You are most likely trying to build from your IDE with debugging enabled, while live coding is enabled in the editor.
In the editor click the three dots near the bottom right corner if the screen and set “Enable Live Coding” to false. Then you can build from your IDE without Live Coding interfering.
The syntax for the UPROPERY macro is correct. (copied it into an actor). The problem is else where.
Perhaps you are putting it in a class that cannot be exposed to blueprints?
i just got it now the difference was that i did not specify it as public, i think the compiler was seeing it as a private file that was why it was unable to readWrite to it.
public:
UMyObject();
UPROPERTY(BlueprintReadWrite, Category = "My Float")
float mainFloat;