FG OSG MSVC9 - First build


jumps: preamble folders building changes downloads end


Having downloaded, and register Microsoft Visual C++ 2008 Express Edition (MSVC9) there was nothing left but to try it out on FlightGear, using my  TWO SOLUTION SYSTEM (TSS)  ;=))

You would think that installing MSVC9 would install everything necessary, but I found that files like dsound.h was missing, so it was necessary to also download and install the necessary SDK ... At first I thought of the Windows SDK - it seems the last Windows Server 2003 R2 Platform SDK has been superseded by Windows SDK for Windows Server 2008 and .NET Framework 3.5, which is available by Web Install, or DVD ISO image ... downloaded from here ...

The image is 1.3GB, so even at around 700KB/sec plus that my internet connection can sometimes achieve, that is about 30 minutes, but the Web Install probably has to download all the SAME stuff, so I download it, and burn it to a DVD (using Roxio), and commence an install ... so about an hour later it is done, BUT STILL NO dsound.h??? In fact all I have installed is a v6.1 SDK, while I already had a v6.0A installed ... oh, well ...

And why do they NOT include the DirectX SDK in this? Who knows! So, through the DirectX Development Center, I download the DirectX SDK - March 2008 - 440MB dxsdk_march2008.exe - about 10 minutes at about 750KB/sec ... another few minutes to unpack dxsdk.exe, and install ... now I have "C:\Program Files\Microsoft DirectX SDK (March 2008)\Include\dsound.h" - of course I have to make sure this 'include' path has made it way into MSVC9 ... yes, Tools -> Options ... -> Projects and Solutions -> VC++ Directories -> Include files has it as first - I move it to last for no particular reason ...


Folder Structure:

My  TSS  requires a rather RIGID folder structure be used. While I retained the WORK folders as before, the SOURCE folders changed slightly :-
(a) I removed the double level of freeglut, which was an error in the first place. Note this requires adding /trunk/freeglut/freeglut to the SVN checkout, and
(b) I used a slightly later version of libpng - 1.2.26 instead of 1225, but retained the old folder name in the work so I would not have to alter the MSVC solution files ;=)).

These adjustments were made to setupfg.bat, the BATCH file that copies all the source from the SOURCE folder to the WORK folder. A copy of this new setupfg.bat is in the vc9sln01.zip file. The idea is that this single file be extracted first to check and do the SOURCE to WORK copying and setup ...

SOURCE Folders WORK Folders
View of source folders View of work folders

As requested by some I have zipped up _ALL_ the sources I used, except FlightGear data, and have made them available for download, HOWEVER it is HIGHLY recommended the the latest sources for each of these be obtained by CVS/SVN where available, or a tar.gz if that is all that is available. Active sources tending to be ever changing for the better, and these zips are frozen in time.



In brief, the build steps are :-

  1. Download vc9sln01.zip, and extract setupfg.bat, to a BASE WORK folder.
  2. Adjust setupfg.bat BASE SOURCE folder, to where you put the up-to-date sources..
  3. Copy sources to a NEW work folder using - BASE-WORK> setupfg new-folder-name
  4. Unzip the full vc9sln01.zip into the new work folder.
  5. Unzip vc9cfg01.zip, preserving paths.
  6. Unzip vc9chg01.zip, if any.
  7. Load MSVC9, and open fgfs/fgfs.sln ...
  8. Build just the libpng, and zlib projects - Release, and optionally Debug.
  9. Run CMake on the OpenSceneGraph folder, selecting MSVC9 (see Note a. below).
  10. Load MSVC9, and open OpenSceneGraph.sln, and build Release.
  11. Reload MSVC9 with fgfs.sln, and build Release (and optionally Debug).
  12. In the MSVC Command prompt, run upd.bat, since it uses nmake, with optional 'D' for Debug also.
  13. Unzip rfgbats09.zip with folders ... these will be put in bin/bats, and 1 in bin/OpenAL
  14. If not done before, cd bin\Openal, and run upd.bat (see Note b. below).
  15. cd bin\bats, and try rfgufo, or any of the other batch file available ...


Simple, huh ;=)) Aside from downloading the various sources, just 15 little steps ...

a. Make sure you CHECK [x] Show Advanced Values, and correctly point -
(i) ZLIB_INCLUDE_DIR to the zlib-1.2.3 folder, and ZLIB_LIBRARY to zlib-1.2.3/zlib.lib, and
(ii) PNG_PNG_INCLUDE_DIR to the lpng1225 folders, and PNG_LIBRARY to lpng1225/libpng.lib
or else some important add-ons will NOT be built. back to CMake ...
b. Or you can copy the three(3) DLLs to a path in the PATH environment variable, and not use the upd.bat, which uses C:\Windows\system32 as the destination. In Windows Vista, this particular path is 'restricted' ... back to OpenAL ...

Almost inevitably, over time, my  TSS  files will become stale. Sources, particularly in SimGear and FlightGear will change - files removed, re-named, and new sources added. Removed, or re-named files are easy - just 'remove' them form the project, and continue.

New sources usually show up in the link, as an 'unresolved external symbol', with a lot to say, like :-

AIBallistic.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall FGAIModelData::modelLoaded(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class SGPropertyNode *,class osg::Node *)" (?modelLoaded@FGAIModelData@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVSGPropertyNode@@PAVNode@osg@@@Z) AIBase.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall FGAIModelData::modelLoaded(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class SGPropertyNode *,class osg::Node *)" (?modelLoaded@FGAIModelData@@UAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVSGPropertyNode@@PAVNode@osg@@@Z)

My method is to use a grep like tool to find where is 'modelLoaded' defined in the source ... and find it in src/AIModel/AIModelData.cxx - add this an continue ... do this with each missing 'unresolved', sometimes in FlightGear, SimGear, plib, or even other sources ... Sometimes adding one new source actually increase the 'unresolved' count, but gradually whittling them down until there are none.

In, it seems, no time at all I WAS FLYING ... with a frame rate of 50-90 fps ...


Source Changes Made

These are source code changes made during the build, but they are included in vc9chg01.zip. It is a good policy to sometimes try a build WITHOUT this 'changes' zip, because sometimes the change has made its way back to the CVS/SVN/tar.gz source.

1. router - part of OpenAL
source: alc.cpp - This needed a _MSC_VER switch, like the __MINGW32__ switch already there, to remove the need for <atlconv.h>
source: OpenAL32.rc - The Windows SDK no longer includes the MFC headers, like "afxres.h", so just changed this to "windows.h" ...
2. OpenAL
source: OpenAL32.rc - As above, changed "afxres.h" to "windows.h".



Date Zip Size Md5
2008/04/21 vc9sln01.zip 93,437 1d51ef80521b7a74855221393667b8b5
2008/04/21 fgvc9rt01.zip 5,149,799 477962240300dd5ee0081245f962a8b9
If you need more help to download the actual sources, then try here




EOP - fgfs-043.htm

checked by tidy  Valid HTML 4.01 Transitional