2、 将matlab安装目录下:toolbox/aeroblks/aerodemos的aerodemos文件夹拷贝至FlightGear的data/Aircraft目录下。
3、 将aerodemos\HL20中的HL20-set.xml文件添加一下语句:
<flight-model>network</flight-model>
4、 确保安装了vs2010或者vc 6,这里测试的是vs2010.
5、 配置vs 2010的编译器:
在控制台输入:mbuild –setup
会提示:
Please choose your compiler for building standalone MATLAB applications:
Would you like mbuild to locate installed compilers [y]/n? n
输入:n
提示:
[1] Microsoft Visual C++ 2005 SP1
[2] Microsoft Visual C++ 2008 Express
[3] Microsoft Visual C++ 2008 SP1
[4] Microsoft Visual C++ 2010
[5] Microsoft Visual C++ 2010 Express
[0] None
Compiler:
输入:4
提示:
Your machine has a Microsoft Visual C++ 2010 compiler located at
d:\Program Files (x86)\Microsoft Visual Studio 10.0. Do you want to use this compiler [y]/n?
Please verify your choices:
Compiler: Microsoft Visual C++ 2010
Location: d:\Program Files (x86)\Microsoft Visual Studio 10.0
Are these correct [y]/n?
输入:y
提示:
****************************************************************************
Warning: Applications/components generated using Microsoft Visual C++
2010 require that the Microsoft Visual Studio 2010 run-time
libraries be available on the computer used for deployment.
To redistribute your applications/components, be sure that the
deployment machine has these run-time libraries.
****************************************************************************
Trying to update options file: C:\Users\YQY\AppData\Roaming\MathWorks\MATLAB\R2010b\compopts.bat
From template: D:\PROGRA~1\Matlab\bin\win64\mbuildopts\msvc100compp.bat
Done . . .
则配置成功
6、 编译:点击 ,第一次会等待大概一分钟左右
7、 然后双击: ,会出现:
FlightGear base directory 中将安装flightgear的路径填上,
之后会生成runfg.bat文件,内容如下:
D:
cd D:\Program Files\FlightGear
SET FG_ROOT=D:\Program Files\FlightGear\\data
.\\bin\\EDIT_THIS_NAME\\fgfs --aircraft=HL20 --fdm=network,localhost,5501,5502,5503 --fog-fastest --disable-clouds --start-date-lat=2004:06:01:09:00:00 --disable-sound --in-air --enable-freeze --airport=KSFO --runway=10L --altitude=7224 --heading=113 --offset-distance=4.72 --offset-azimuth=0
这里需要将第三行的.\\bin\\EDIT_THIS_NAME\\去掉,然后将D:\Program Files\FlightGear\bin;加入系统环境变量中。(即将flightgear安装目录下的bin的路径加至环境目录,修改的地方原来的意思是进入这个安装flightgear的文件夹下的bin中调用fgfs.exe文件,这里修改的原因是安装flightgear之后发现data文件夹下没有bin文件)
修改之后的文件内容为:D:
cd D:\Program Files\FlightGear