另外还会提示warning C4819:The file contains a character that cannot be represented in the current code page<936>.Save the file in Unicode format to prevent data loss
If you have a hex editor program, just open your file with it and shortly after the standard header intro stuff (like "This program cannot be run in DOS mode...") you will see either
"PE..L" (hex code: 504500004C) = 32 bit
or
"PE..d†" (hex code: 504500006486) = 64 bit
if not "%PROCESSOR_ARCHITECTURE%"=="AMD64" goto amd64crosscompile
rem AMD64 Native builds
@ECHO WARNING: x64 Native compiling isn't supported. Using cross compilers.
REM goto envtest
编译器上显示的就是这句。
然后我用同样的一个简化的批处理判断
IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" GOTO REGAMD64
IF "%PROCESSOR_ARCHITECTURE%"=="x86" GOTO REGX86
:REGAMD64
@ECHO WARNING: x64
:REGX86
@ECHO WARNING: x86
我自己的机器的PROCESSOR_ARCHITECTURE是amd64
上面那个批处理中无论机器架构是amd64还是x86最终都会调用下面这一句:
:amd64crosscompile
rem X86 to AMD64 cross compile
set PATH=%BASEDIR%\bin\x86\amd64;%BASEDIR%\bin\x86;%BASEDIR%\bin\SelfSign;%PATH%
set PATH=%BASEDIR%\tools\pfd\bin\bin\x86_AMD64;%BASEDIR%\bin\SelfSign;%PATH%
goto envtest
只不过如果是amd64时,会显示x64 Native compiling isn't supported. Using cross compilers.