如果先安装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++编译器批处理文件)