24 May 2012

Delphi XE2 : Compile error : Invalid PLATFORM variable "HPD"

Problem :

I just install a new Delphi XE2.
I create a new classical VCL project and I try to compile it.
I obtain this message :

'[Error Erreur] Invalid PLATFORM variable "HPD". PLATFORM must be one of the following: "Win32", "Win64", or "OSX32". If PLATFORM is defined by your system's environment, it must be overridden in the RAD Studio IDE or passed explicitly on the command line to MSBuild; e.g., /p:Platform=Win32.'

Reason :

It's a battle between Microsoft and Hewlett Packard over
the use of the PLATFORM environment variable.

"HP Easy Setup" uses it for it's own purposes.
MSBUILD uses it for another purpose.

Solution :

Right click on "My Computer" and select Properties. In the Advanced tab,
you will find a button for "Environment Variables". Click on it, and in
the list that follows, delete the PLATFORM variable from the list of
System variables.
Close the dialog, restart XE2, you should now be able to recompile
without further problems

Source :