如果先安裝AMESIM,后安裝VC++編譯器,AMESIM編譯時可能提示找不到可執行文件。下面是可能的解決方案。
環境:
操作系統:XP,x86
軟件:AMESIM 8A(安裝目錄:D:\AMESim\v800,路徑中不能有中文、空格等),VC++6.0(安裝目錄:D:\Program Files\Microsoft Visual Studio)
處理辦法:
1、將VC++編譯器中的Bin\vcvars32.bat拷貝到AMESIM安裝目錄下;
2、打開AMESim下misc目錄中的RunAMESimTemplate.bat,將其中set AME=***改為本機實際的AMESIM的安裝目錄,例如set AME=D:\AMESim\v800,然后運行該批處理文件。
注意,該批處理文件默認只讀,可將其只讀屬性取消再修改其內容。
實質解決方案:
當我們運行AMEsim,再次編譯時,可能仍然無法編譯,原因是環境變量問題。運行RunAMESimTemplate.bat打開的AMEsim可以編譯,否則不可以編譯,那么RunAMESimTemplate.bat中隱藏了什么呢?讓我們打開該文件看看:
@echo off
echo This is an example on how to run an AMESim version which
echo is different from the latest one.? You can use this,
echo for instance, to run AMESim x.y on a machine where you have
echo installed AMESim z.t.? Lines after "CHANGE THIS" are likely
echo to be changed.
REM The setlocal makes any changes to environment variables local
REM between here and the endlocal flag.
setlocal
REM We define the AME environment variable:
REM this will of course be different for each usage.
REM CHANGE THIS
set AME=d:\AMESim\v800
REM Here are defined environment variable for MSVC++
call %AME%\vcvars32.bat
REM We can here also change directory to where we want to start
REM for instance "c:\ametest".
REM CHANGE THIS
rem cd c:\ametest
REM then we set up the path to include the AME directory (and the licensing directory).
SET PATH=%AME%;%AME%\win32;%AME%\mingw32\bin;%PATH%
REM Finally run AMESim, using the AME environment variable to make
REM sure that we run the AMESim we want to run.
start %AME%\win32\AMESim
endlocal
REM Make the DOS window wait for a key press, to catch any error printouts
pause
這個批處理文件關鍵的語句是:
set AME=d:\AMESim\v800
SET PATH=%AME%;%AME%\win32;%AME%\mingw32\bin;%PATH%
start %AME%\win32\AMESim
前兩個語句設置了環境變量,第三個啟動AMEsim軟件。也就是說,是環境變量設置有問題。
打開操作系統環境設置窗口,在系統變量Path中添加%AME%;%AME%\win32;%AME%\mingw32\bin,并保存。再次打開AMEsim,進行編譯,就可以通過編譯(有可能需要先重啟系統,使得環境變量生效)。
如果還有問題,建議仔細分析一下這兩個文件:%AME%\AMEcompile80.bat(AMESim編譯批處理文件)和%AME%\vcvars32.bat(AMESim調用VC++編譯器批處理文件)