Delphi platform error on Hewlett Packard customize

2019-07-07 04:41发布

问题:

I keep getting the same error setting up my computer so it will run Delphi, I've already set up a user override on the PLATFORM environment variable, to convert it to win32 but it's still giving the same error;

[Error Error] Invalid PLATFORM variable "HPD". PLATFORM must be one of the following: "Win32", "Win64", "Android", "iOSSimulator", "iOSDevice", 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.

Can anyone explain why it's doing this and how to fix the error? The fact that I was working in Delphi XE2 in college and I'm using Delphi XE3 now may affect this

回答1:

You're probably using an HP computer. They come pre-configured with a PLATFORM environmental variable.

The newer XPlatform versions of Delphi use the PLATFORM variable to track what the target build is for (WIN32, WIN64, ANDROID, iOSSimulator, iOSDevice,or OSX32). Since there's already one there, it's trying to use it, but can't figure out what to do with a target of HPD.

The easiest way to fix this for all your projects is to go into your computer's settings (right-click My Computer on the desktop or Start Menu, Properties->Advanced System Settings->Environmental Variables, and just delete the PLATFORM variable. (HP doesn't seem to use it for anything, and I've done this on half a dozen computers with no ill effects.)



回答2:

This is a known problem (see for example Chris Rolliston's blog) with HP computers - they do set up a system environment variable called PLATFORM which conflicts with the parameter expected by MSBuild. Solution is to delete the environment variable.