Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
Building FlightGear 0.9.10 using Microsoft Visual Studio .NET 2005 (Express Edition) - circa Wednesday, 05 April 2006. It covers the folder structure, compiling freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, then the running of FlightGear, including some downloads ...
It is important to get this right to be able to use any of the 'components' provided here, like the SLN/VCPROJ files, in downloads below ... I start with a simple root folder, in this case - c:\FG0910-2 - the '-2' in this case just denotes a second build of FlightGear 0.9.10 ... I have already built it using MSVC7.1, the previous version of MSVC ... the FOLDER structure is -
   Folder                      
   Content
   
   FG0910-2\freeglut          - latest CVS update
   (#1)
   
          
   \PLIB              - latest
   CVS download of PLIB
   
          
   \AL\openal         - latest CVS version of OpenAL
   
          
   \pthreads          - latest CVS update of pthreads
   
          
   \zlib-1.2.3        - this is from zlib-1.2.3.tar.gz
   
           \SimGear\source    - latest CVS
   update
   
           \FlightGear\source - latest CVS update
   
                     
   \data   - latest CVS update
  
#1 - Note, the CVS folder is freeglut/freeglut, but in this copy have reduced it to one freeglut ;=))
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
Previously I had used the GLUT32 that normally comes with a Windows SDK distribution, but because it does not seem to be included in the MSVC8 SDK download, I have decided to try this version ... the CVS check-out was easy, however it loads into a freeglut/freeglut folder ... for this build I have removed one of the freeglut folders, as mentioned above ...
It does not yet sport SLN/VCPROJ files, so chose the MSVC6 DSW/DSP files ... they load and convert easily ... it has two projects, a DLL, and a static library ... both are built at the same time ... of course I choose to use the static library, since this reduces the later setup for using DLLs ... see Running FlightGear below ...
BUT, I note from reading the freeglut_std.h header, that to use the STATIC LIBRARIES, I will have to #define FREEGLUT_STATIC in the projects that include glut.h - namely SimGear, and FlightGear, or else the default DLLs will be used ...
   After the build, I have two(2) DLL, and four(4) libraries -
   
   Directory of C:\FG0910-2\freeglut\Debug
   
   04/04/2006  04:40 PM           802,816
   freeglut.dll
   
   Directory of C:\FG0910-2\freeglut\Release
   
   04/04/2006  04:42 PM           270,336
   freeglut.dll
   
   Directory of C:\FG0910-2\freeglut\Debug
   
   04/04/2006  04:38 PM           
   32,228 freeglut.lib
   
   Directory of C:\FG0910-2\freeglut\DebugStatic
   
   04/04/2006  04:41 PM         1,072,774
   freeglut_static.lib
   
   Directory of C:\FG0910-2\freeglut\Release
   
   04/04/2006  04:42 PM           
   32,228 freeglut.lib
   
   Directory of C:\FG0910-2\freeglut\ReleaseStatic
   
   04/04/2006  04:42 PM           502,146
   freeglut_static.lib
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
PLIB does not yet have MSVC8 SLN/VCPROJ build files, so I load the PLIB.DSW, and allow MSVC8 to convert the files ... I also remember to go through each project, checking that each is /MT (for Release) and /MTd, for debug. I thought of adding the FREEGLUT_STATIC define, but it turns out this is not necessary, since when the static PUI library is being built, PU_USE_NONE is defined ...
   AND, to be SURE I am using ONLY the freeglut headers, I renamed -
   
   C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\GL to GLvc7, and
   
   C:\Program Files\Microsoft Visual Studio\VC98\Include\GL to GLvc98
  
Wow, they Microsoft compiler developers really 'choose their own thing' ... compiling PLIB with the previous MSVC7.1, there were very few WARNINGS in MSVC7.1 (or earlier) but they can now come up with HUNDREDS of WARNINGS, AND SOME ERRORS!!!.
Someone was at least sensible enough to add a HINT to some of the warnings ... now I just need a way to AUTOMATICALLY define the pre-processor item of _CRT_SECURE_NO_DEPRECATE ... ;=)) Without this pre-processor define, just about every string operation comes up with a WARNING - like -
   1>c:\fg0910-2\plib\src\util\ul.h(551) : warning C4996: 'strcpy' was
   declared deprecated
   
   1>        c:\Program Files\Microsoft Visual Studio
   8\VC\include\string.h(73) : see declaration of 'strcpy'
   
   1>        Message: 'This function or variable may be
   unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE.
   See online help for details.'
  
   AND they have considerable tightened up on the 'const' qualifier ... for example ...
   
   void foo( const char * cp ) {
   
     char * p strchr(cp,'a');
   
 will yield an ERROR -
   
   error C2440: 'initializing' : cannot convert from 'const char *' to 'char
   *'
  
   Apparently PLIB had already found that the BORLAND-BUILDER also has this tighter constraint,
   and has added a compiler switch to over come it ... UL_BB gets defined if using the Borland
   builder product ... like -
   
   #ifdef UL_BB
   
             char *s = strrchr ( (char*)tfname, '\\'
   ) ;
   
   #else
   
             char *s = strrchr ( tfname, '\\' ) ;
   
   #endif
  
   It seems some PLIB developers have really not understood the meaning of a 'const' qualifier ...
   look at this dozy ...
   
   bool ssgLoadMDLTexture ( const char *fname, ssgTextureInfo* info ) {
   
     FILE *tfile;
   
     int index = 0;
   
     if ( (tfile = fopen(fname, "rb")) == NULL) {
   
   #ifdef UL_BB
   
               char *p =
   strrchr((char*)fname,'_');
   
   #else
   
               char *p = (char
   *)strrchr(fname,'_');
   
   #endif
   
     if (p != 0) {
   
       *p = '\0';
   
       p++;
   
       index = atoi (p);
   
       if ( (tfile = fopen(fname, "rb")) == NULL) {
   
         ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s'.",
   fname );
   
         return false ;
   
       }
   
       p--;
   
       *p = '_';
   
     } else {
   
         ulSetError( UL_WARNING, "ssgLoadTexture: Failed to load '%s'.",
   fname );
   
         return false ;
   
     }
   
   }
  
The function receives a file name pointer, WITH the 'const' qualifier, but the function proceeds to MODIFY that CONSTANT !!!???!!! In fact, if the file does have an underscore, (_) as part of its name, and if, AFTER SENDING THE CONSTANT TO ZERO, the file does not exist, the function will RETURN 'false', leaving the so called 'CONSTANT' file name MODIFIED ... yowee, what can/will they think of next?
   So, by adding a UL_MSVC, one can eventually get through the compile, like -
   
   static char *mystrchr( const char *string, int c )
   
   { // like strchr, but string may be NULL
   
         if (string == NULL )
   
               return NULL;
   
         else
   
   #if (defined(UL_BB) || defined(UL_MSVC))
   
               return strchr( (char*)string, c
   );
   
   #else
   
               return strchr( string, c );
   
   #endif
   
   }
  
But one still WONDERS about a function that is PASSED a 'const' string pointer, and can return a pointer to any part of that string, BUT REMOVE THE 'const' QUALIFIER ...
   AND the fun continues with the naming of certain functions, like open() ... here is the warning
   message -
   
   4>.\slMODfile.cxx(586) : warning C4996: 'open' was declared deprecated
   
   4>        c:\Program Files\Microsoft Visual Studio
   8\VC\include\io.h(328) : see declaration of 'open'
   
   4>        Message: 'The POSIX name for this item is
   deprecated. Instead, use the ISO C++ conformant name: _open. See online help for
   details.'
  
More changes ;=)) When completed, all the static libraries, and important headers have been copied to the root PLIB folder -
   Header List -
   
   Directory of C:\FG0910-2\PLIB
   
   fnt.h             js.h                  
   net.h                 
   netBuffer.h
   
   netChannel.h      netChat.h             
   netMessage.h           netMonitor.h
   
   netSocket.h       psl.h                 
   pu.h       
              puAux.h
   
   puFLTK.h          puGLUT.h              
   puNative.h             puPW.h
   
   puSDL.h           pw.h                  
   sg.h                  
   sl.h
   
   slPortability.h   sm.h                  
   ssg.h                 
   ssgaFire.h
   
   ssgaLensFlare.h   ssgaParticleSystem.h  
   ssgaScreenDump.h       ssgaShapes.h
   
   ssgaSky.h         ssgAux.h              
   ssgaWaveSystem.h       ssgconf.h
   
   ssgKeyFlier.h     ssgMSFSPalette.h      
   ul.h                  
   ulRTTI.h
  
   Library List -
   
   Directory of C:\FG0910-2\PLIB
   
   fnt.lib      fnt_d.lib   
   js.lib       js_d.lib    
   net.lib      net_d.lib
   
   psl.lib      psl_d.lib    puAux.lib   
   puAux_d.lib  pui.lib      pui_d.lib
   
   pw.lib       pw_d.lib     sg.lib       sg_d.lib     sl.lib      
   sl_d.lib
   
   ssg.lib      ssgAux.lib   ssgAux_d.lib ssg_d.lib    ul.lib      
   ul_d.lib
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
Here I had the choice of a MSVC8 solution file, or the MSVC6 DSW/DSP file ... I chose the former first, and to my surprise, was asked if MSVC8 should proceed with a conversion ... maybe there are variants within MSVC8 ?...
But when I tried to run a compile, I got the error - missing dsound.h file ... I know this is in my MSVC6 includes, but maybe not yet in MSVC8 include directories ... I note the only includes is say the ALc 'Properties', C/C++ page, are " ..\..\include, ..\OpenAL32\Include" ... maybe I have to check the 'system' include settings ...
Checking menu Tools -> Options dialog ... expanding 'Projects and Settings', and selecting 'VC++ Directories', and choosing to 'Show directories for: Include files' I can see a list -
   $(VCInstallDir)include
   
   $(VCInstallDir)PlatformSDK\include
   
   $(FrameworkSDKDir)include
   
   C:\Program Files\Microsoft Platform SDK\include
  
   the latter being where I downloaded and installed the 'Microsoft Platform SDK' ... But where
   does it get $(VCInstallDir) from? It is NOT a variable in my 'environment - type
   set<enter> at the command prompt to see this list ... I do find -
   
   VS80COMNTOOLS=c:\Program Files\Microsoft Visual Studio
   8\Common7\Tools\
   
   in the environment ...
  
   I try the registry, but only find it used in the above list ... I do have dsound.h in -
   
   C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include
   
   but that is Vc7 ...
  
   Maybe I have to DOWNLOAD some more ... going to the site -
   
   http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
   
   I can READ ...
   
   <quote>
   
   Step 2: Install the Microsoft Platform SDK.
   
   Install the Platform SDK over the Web from the Download Center. Follow the instructions and
   install the SDK for the x86 platform.
   
   Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options
   dialog box.
   
   Add the paths to the appropriate subsection:
   
   Executable files: C:\Program Files\Microsoft Platform SDK\Bin
   
   Include files: C:\Program Files\Microsoft Platform SDK\include
   
   Library files: C:\Program Files\Microsoft Platform SDK\lib
   
   Note: Alternatively, you can update the Visual C++ Directories by modifying the
   VCProjectEngine.dll.express.config file located in the \vc\vcpackages subdirectory of the
   Visual C++ Express install location. Please make sure that you also delete the file
   "vccomponents.dat" located in the "%USERPROFILE%\Local Settings\Application
   Data\Microsoft\VCExpress\8.0" if it exists before restarting Visual C++ Express Edition.
   
   </quote>
  
   I had already downloaded, and run the PSDK-x86.exe (1.3MB) ... and I run it again ... but no
   dsound.h is added to C:\Program Files\Microsoft Platform SDK\include ... the ONLY 2 I can find
   are -
   
   Directory of C:\Program Files\Microsoft Visual Studio\VC98\Include
   
   23/04/1998  04:00 PM           
   40,957 DSOUND.H, and
   
   Directory of C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include
   
   19/06/2002  11:56 AM           110,604
   dsound.h
  
   I choose to use the latter ... ;=() AND I have to include -
   
   C:\Program Files\Microsoft Platform SDK\Include\atl
   
   for atlconv.h,
  
   AND C:\Program Files\Microsoft Platform SDK\Include\mfc
   
   for afxres.h, includes in the OpenAL32.rc file - WHICH I LEARN CAN NOT BE EDITED BY THE EXPRESS
   EDITION ...
  
   Then could not load dxguid.lib, so to the link, had to add -
   
   C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Lib
  
Also, the NEW idea of allowing 2 (or more) projects to be built in PARALLEL IS VERY CONFUSING ... I returned this to ONE - that is one at a time ... so you can see what errors happened to what ... I am sure this type of 'parallel' building actually gains no additional time ... in fact, overall, it may end up SLOWER ... It is certainly SLOWER in the sense that it takes EXTRA TIME to sort out exactly which project is causing the ERROR ...
   Also, the LINKER warning, like -
   
   Linking...
   
   al.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
   
 always bugs me, so, under the linker, General tab, I always switch the 'Enable
   Incremental Linking:' to 'Default', especially since 'Edit and Continue' IS enabled, by DEFAULT
   ...
  
As usual, to remove a linker warning about default library conflict, I had to make sure every AL project is set to the same Runtime Library, namely /MTd for Debug, and /MT for Release ...
   Also, since I seldom use it, and it can be generated later anyway, I always turn OFF the
   generation of the 'Browsing' information ... eventually I reach a stage where I can do a 'Clean
   Project', and then re-build, and end up with a message -
   
   ========== Build: 5 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
  
But this is NOT the end of OpenAL ... it seems that SimGear also uses the ALut library to load 'WAV' files ... maybe I can ADD the ALut.vcproj file to this OpenAL.sln ...
   Then comes some SILLINESS about the OpenAL include files ... in order to build the alut
   project, alut.h, al.h and alc.h are needed, BUT they must be in a folder called AL ... that is
   the include is <AL/alut.h> ... I could have used two paths, like -
   
   ..\..\..\include;..\..\..\..\include
   
   the first is to get to alut.h, and the second to get to al.h and alc.h, BUT then I would have
   to add these TWO PATHS, modified accordingly to the specific project, in other projects that
   require alut.h, like SimGear ...
  
   Rather than doing this, you will note the OpenAL folder, already starts with an AL folder, so I
   copy these three files, alut.h, al.h, and alc.h to the AL folder, much like PLIB does ... this
   means I can use ONE include directory to get to them all -
   
   ..\..\..\..\..\..
   
   and I create a Pre-Build step in the alut project to copy alut.h, and a Post-Build step in the
   Router project, to do this copying, so I will not forget in future ...
  
   Eventually you reach some 'silliness' similar to PLIB build, like -
   
   alutError.c
   
   c:\fg0910-2\al\openal\alut\src\aluterror.c(10) : warning C4996: 'getenv' was declared
   deprecated
   
           c:\program files\microsoft visual studio
   8\vc\include\stdlib.h(483) : see declaration of 'getenv'
   
           Message: 'This function or variable may be unsafe.
   Consider using _dupenv_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See
   online help for details.'
  
Why have Microsoft chose to depreciate some of these functions? Anyway, as the 'hint' suggests, I add _CRT_SECURE_NO_DEPRECATE to the project, to hopefully kill the warning ... this is in a alut project, under the C/C++ page, selecting Peprocessor, under the title 'Preprocessor Definitions' ... making the list even larger -
ALUT_BUILD_LIBRARY; HAVE__STAT; HAVE_BASETSD_H; HAVE_SLEEP; HAVE_WINDOWS_H; _CRT_SECURE_NO_DEPRECATE
   But there is one last fatal link error -
   
   LINK : fatal error LNK1104: cannot open file 'openal32.lib'
  
   Again similar to PLIB, I copy the OpenAL32.lib up to my AL folder ... so I will not forget this
   in future, I make it a Post-Build Step in the Router project ...
   
   copy .\Debug\OpenAL32.lib ..\..\..\.
   
   and of course correct the 'Additional Include Directories' of the linker in the alut project
   ...
  
   Finally, the new MANIFEST error -
   
   Embedding manifest...
   
   mt.exe:Command Line error c1010007:Unexpected/Unknown argument "/notify_update"
   
   On the alut Property Pages, expanding the Configuration Properties, Manifest Tool, and
   selecting 'Input and Output', and changing 'Embed Manifest' to 'No' ... and I get a complete
   link ...
  
   When completed, there are SIX(6) DLLs -
   
   Directory of
   C:\FG0910-2\AL\openal\alut\admin\VisualStudioDotNET\alut\Debug
   
   04/04/2006  02:32 PM           
   69,632 alut.dll
   
   Directory of C:\FG0910-2\AL\openal\alut\admin\VisualStudioDotNET\alut\Release
   
   04/04/2006  05:50 PM           
   23,552 alut.dll
   
   Directory of C:\FG0910-2\AL\openal\win\OpenAL32\Debug
   
   04/04/2006  02:32 PM           696,320
   wrap_oal.dll
   
   Directory of C:\FG0910-2\AL\openal\win\OpenAL32\Release
   
   04/04/2006  05:50 PM           188,416
   wrap_oal.dll
   
   Directory of C:\FG0910-2\AL\openal\win\Router\Debug
   
   04/04/2006  02:32 PM           589,824
   OpenAL32.dll
   
   Directory of C:\FG0910-2\AL\openal\win\Router\Release
   
   04/04/2006  05:50 PM           
   98,304 OpenAL32.dll
  
   And TEN(10) libraries -
   
   Directory of
   C:\FG0910-2\AL\openal\alut\admin\VisualStudioDotNET\alut\Debug
   
   04/04/2006  02:32
   PM             5,436 alut.lib
   
   Directory of C:\FG0910-2\AL\openal\alut\admin\VisualStudioDotNET\alut\Release
   
   04/04/2006  05:50
   PM             5,436 alut.lib
   
   Directory of C:\FG0910-2\AL\openal\win\Alc\Debug
   
   04/04/2006  02:32 PM           139,494
   ALc.lib
   
   Directory of C:\FG0910-2\AL\openal\win\Alc\Release
   
   04/04/2006  05:49 PM           
   49,608 ALc.lib
   
   Directory of C:\FG0910-2\AL\openal\win\Alu\Debug
   
   04/04/2006  02:32 PM           
   42,444 ALu.lib
   
   Directory of C:\FG0910-2\AL\openal\win\Alu\Release
   
   04/04/2006  05:49 PM           
   11,192 ALu.lib
   
   Directory of C:\FG0910-2\AL\openal\win\OpenAL32\Debug
   
   04/04/2006  02:32 PM           
   20,328 wrap_oal.lib
   
   Directory of C:\FG0910-2\AL\openal\win\OpenAL32\Release
   
   04/04/2006  05:50 PM           
   20,328 wrap_oal.lib
   
   Directory of C:\FG0910-2\AL\openal\win\Router\Debug
   
   04/04/2006  02:32 PM           
   20,004 OpenAL32.lib
   
   Directory of C:\FG0910-2\AL\openal\win\Router\Release
   
   04/04/2006  05:50 PM           
   20,004 OpenAL32.lib
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
This does not have a SLN/VCPROJ build files, so I use the DSW/DSP from MSVC6 ... I remember to check the runtime libraries, and change it to /MTd and /MT respectively for Debug and Release configuration ... the first run produces the usual warning ...
   pthread.c
   
   c:\fg0910-2\pthreads\ptw32_relmillisecs.c(97) : warning C4996: '_ftime64' was declared
   deprecated
   
           c:\program files\microsoft visual studio
   8\vc\include\sys\timeb.h(152) : see declaration of '_ftime64'
   
           Message: 'This function or variable may be unsafe.
   Consider using _ftime64_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See
   online help for details.'
   
   so I add _CRT_SECURE_NO_DEPRECATE to the preprocessor defines ... and ...
  
   Embedding manifest...
   
   mt.exe:Command Line error c1010007:Unexpected/Unknown argument "/notify_update"
   
   mt.exe exited with error - Invalid / Missing command-line arguments.
   
   Project : error PRJ0002 : Error result 1 returned from 'c:\Program Files\Microsoft Visual
   Studio 8\VC\bin\mt.exe'.
   
 so I go in and change the Manifest tool to 'No' ...
  
It is interesting to note that the library and DLL produced are called pthreadsVC2.lib and pthreadsVC2.dll ... it was at this point that I noted the build files had placed the object file, the library, and the DLL all in the same folder as the source. This means a Release version would overwrite a debug version, and vice versa ... so I 'fix' the build files to use the 'standard' Debug and Release directories for their respective outputs ...
   The results of the compile is then two(2) DLL and two(2) libraries -
   
   Directory of C:\FG0910-2\pthreads\Debug
   
   05/04/2006  01:35 PM           520,192
   pthreadVC2.dll
   
   Directory of C:\FG0910-2\pthreads\Release
   
   05/04/2006  01:34 PM           
   77,824 pthreadVC2.dll
   
   Directory of C:\FG0910-2\pthreads\Debug
   
   05/04/2006  01:35 PM           
   29,056 pthreadVC2.lib
   
   Directory of C:\FG0910-2\pthreads\Release
   
   05/04/2006  01:34 PM           
   29,056 pthreadVC2.lib
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
I first tried to load the provided by a contributor, some vc8 solution files, but these failed to build ... so I fall back to loading the MSVC6 DSW/DSP files provided ... these allow you to build EIGHT(8) projects ... I choose to build only TWO(2) ... see the README.txt ...
   * Win32_LIB_Release\zlib.lib       
   static build
   
   * Win32_LIB_Debug\zlibd.lib         static build (debug
   version)
  
I do REMEMBER to go into the Properties, and change them the /MT and /MTd respectively ...
   The new HABIT of MSVC8 begin to wear thin ;=)) with the usual warning -
   
   gzio.c
   
   c:\fg0910-2\zlib-1.2.3\gzio.c(131) : warning C4996: 'strcpy' was declared deprecated
   
           c:\program files\microsoft visual studio
   8\vc\include\string.h(73) : see declaration of 'strcpy'
   
           Message: 'This function or variable may be unsafe.
   Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See
   online help for details.'
  
   But even after adding the above, I still get -
   
   minigzip.c
   
   c:\fg0910-2\zlib-1.2.3\minigzip.c(216) : warning C4996: 'unlink' was declared deprecated
   
           c:\program files\microsoft visual studio
   8\vc\include\stdio.h(290) : see declaration of 'unlink'
   
           Message: 'The POSIX name for this item is
   deprecated. Instead, use the ISO C++ conformant name: _unlink. See online help for
   details.'
  
Life was certainly EASIER when a zlib source was included as part of SimGear, but time change ;=)) Now I THINK I am ready to build SimGear ...
   After quite an amount of 'fiddling' I eventually get TWO(2) static libraries built -
   
   Directory of C:\FG0910-2\zlib-1.2.3\projects\visualc6\Win32_LIB_Debug
   
   04/04/2006  03:31 PM           248,124
   zlibd.lib
   
   Directory of C:\FG0910-2\zlib-1.2.3\projects\visualc6\Win32_LIB_Release
   
   04/04/2006  03:31 PM           102,902
   zlib.lib
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
   SimGear now sports a VC8 SLN/VCPROJ build files, in source/projects/VC8, so I choose to try
   these ... the first run copies simgear_config.h-vc5 to simgear_config.h, so this step is
   automated nicely ... but it can not find the PLIB headers ... the additional include
   directories is -
   
   ../..;../../..;../../Simgear; ../../../AL/include; "../../../zlib-1.2.3";
   "../../../Pre-built.2/include"
   
   but the depth of the vcproj file is -
   
   C:\FG0910-2\SimGear\source\projects\VC8\SimGear.vcproj
  
   This suggests it must backup 4 folders, not 3, to match my folder structure ... I end up with
   the line -
   
   ../..; ../../../..; ../../Simgear; ../../../../zlib-1.2.3;
   ../../../../pthreads
  
   After this, ignoring the 'warnings', SimGear - 0 error(s), 21 warning(s), the compile proceeds
   smoothly, and I end up with TWO(2) static libraries - one Debug and one Release ...
   
   Directory of C:\FG0910-2\SimGear\source\projects\VC8\Debug
   
   04/04/2006  04:02 PM        32,560,536 SimGear.lib
   
   Directory of C:\FG0910-2\SimGear\source\projects\VC8\Release
   
   04/04/2006  04:06 PM        22,198,602
   SimGear.lib
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
   Having learnt from SimGear, I first check the additional include line -
   
   ../../../; ../../../Simgear; ../../src; ../../../AL/include;
   ../../../zlib-1.2.3; ../../../freeglut-2.4.0/include;  ../../../Pre-built.2/include;
   ../../src/include; ../../src/input; ../../src/FDM/JSBSim
   
 And adjust this to -
   
   ../../../../; ../../../../SimGear/source; ../../src;../../../..;
   ../../../../zlib-1.2.3; ../../src/include; ../../src/input; ../../src/FDM/JSBSim;
   ../../../../pthreads; ../../../../freeglut/include
  
   The FlightGearLib succeeds, provided you ignore the 'warnings' - FlightGearLib - 0 error(s),
   326 warning(s), but the FlightGear EXE link fails -
   
   LINK : fatal error LNK1104: cannot open file 'Simgear.lib'
  
   Time to look at the linked library list ...
   
   FlightgearLib.lib Simgear.lib fnt_d.lib js_d.lib net_d.lib psl_d.lib
   puAux_d.lib pui_d.lib pw_d.lib sg_d.lib sl_d.lib ssg_d.lib ssgAux_d.lib ul_d.lib pthreadvc2.lib
   Alut.lib openal32.lib zlibd.lib wsock32.lib advapi32.lib comdlg32.lib shell32.lib
   user32.lib
  
   And the additional directories searched to find these libraries ...
   
   "FG$(IntDir)";../../../plib/;"../../../Simgear/Projects/VC8/$(IntDir)";
   "../../../freeglut-2.4.0/$(IntDir)Static";"../../../Pre-Built.2/lib";
   "../../../zlib-1.2.3/projects/visualc6/win32_lib_asm_$(IntDir)"; ../../../al/lib
  
   The depth of the vcproj file is -
   
   C:\FG0910-2\FlightGear\source\projects\VC8
   
   so it is 4 sets of '..' to get out of FlightGear ...
   
   FG$(IntDir); ../../../../plib/;
   ../../../../SimGear/source/Projects/VC8/$(IntDir); ../../../../freeglut/$(IntDir)Static;
   ../../../../pthreads/$(IntDir); ../../../../zlib-1.2.3/projects/visualc6/Win32_LIB_$(IntDir);
   ../../../../AL
  
   Still a small thing -
   
   Linking...
   
   Embedding manifest...
   
   mt.exe:Command Line error c1010007:Unexpected/Unknown argument "/notify_update"
   
   mt.exe exited with error - Invalid / Missing command-line arguments.
   
   Project : error PRJ0002 : Error result 1 returned from 'c:\Program Files\Microsoft Visual
   Studio 8\VC\bin\mt.exe'.
   
   As usual one must turn off the manifest ... Why did MS default this to ON???
  
   And it SUCCEEDS -
   
   FlightGear - 0 error(s), 0 warning(s)
  
   For some unknown reason, these new VC8 project files have divided FlightGear into a static
   library, and an EXE. After the compile and link, there are two(2) static libraries, and the
   important part, the two(2) EXE files -
   
   Directory of C:\FG0910-2\FlightGear\source\projects\VC8\FGDebug
   
   04/04/2006  05:09 PM       171,282,284 FlightGearLib.lib
   
   Directory of C:\FG0910-2\FlightGear\source\projects\VC8\FGRelease
   
   04/04/2006  06:27 PM       119,509,520 FlightGearLib.lib
   
   Directory of C:\FG0910-2\FlightGear\source\projects\VC8\Debug
   
   05/04/2006  01:56 PM        20,426,280 FlightGear.exe
   
   Directory of C:\FG0910-2\FlightGear\source\projects\VC8\Release
   
   05/04/2006  01:52 PM         4,132,864
   FlightGear.exe
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
Of course, the first thing is to download, or update the FlightGear\data folder, with the latest scenery and other essential file ...
Dependent projects that were build as static libraries are no problem, freeglut, PLIB, zlib, SimGear, since the necessary code was extracted from those libraries and embedded in the final EXE at link time, but for those in DLL form, the DLL must be 'installed' ...
Essentially, a DLL can be placed in the SAME folder as the EXE, or in ANY PATH given in the PATH environment variable ... but OpenAL has some RESTRICTIONS in this regard. The wrap_oal.dll is not dynamically loaded ... it is statically loaded by the OpenAl32.dll, and its exported headers enumerated. Presently the OpenAL code has a 'restriction' that this particular DLL MUST be in the 'system' folder - usually c:\WINDOWS\System32, depending on how windows was loaded ...
For OpenAL, I use a simple makefile to do the copying, updating of the DLLs to my system folder ... it also includes a clean: target, so I can likewise remove these DLLs. This is necessary if I intend to also run the cygwin built version of FlightGear ... quite often, either cygwin already has the appropriate DLLs, or uses a different version, and these MSVC8 built DLLs can often provide a conflict ...
Since make files depend on the date, I often first run the clean target to remove what is there before I proceed with the update ... this ensures what I want is getting copied there ... now I am ready to RUN FLightGear.EXE ...
   I create a small batch file - rfg.bat - containing -
   
   source\projects\VC8\Release\FlightGear.exe --fg-root=data --fdm=ufo --aircraft=ufo
   --log-level=debug
   
   but this exits before getting anywhere ... I was able to run FlightGear.exe in the MSVC8
   debugger ... this of course is VERY SLOW ... but came across a runtime error which stated the
   ESP had not been saved over a call, suggesting the call was declared as one type of call
   convention, but the actual call was made using another convention ... but, as stated, it sort
   of ran ...
  
I re-compiled the FG Release configuration with optimisation disabled, and it ran fine ;=)) The original optimisation was 'Maximum Speed (/O2)' ... The next build was with 'Disabled (/Od)' ... I then try 'Full Optimisation (/Ox)', and change 'Favor Size or Speed' from 'Neither' to 'Favor Fast Code (/Ot)' ... it takes about 15 minutes to recompile the some 420 source files that make up the main FlightGear application ... now to try running it ...
AND IT RUNS! ;=)) I forgot to set the time-of-day, so ended up in the San Francisco night. I can change this through menu system while running, but at this point, prefer to put my 'preferences' in a system.fgfsrc file which rests in the scenery root ... then I can run FlightGear with just one command line option, namely --fg-root=data, and my other preferences will be read from this file ...
This is a sample of my typical system.fgfsrc - note, any line beginning with at least one '#' is a comment only -
   --timeofday=noon
   
   --altitude=1000
   
   --aircraft=ufo
   
   --fdm=ufo
   
   --prop:/sim/hud/draw-fps=true
   
   --enable-hud
   
   ###--visibility=60000
   
   ###--visibility=120000
   
   ###--visibility-miles=40
   
   --control=joystick
   
   ###--disable-random-objects
   
   --disable-clouds
   
   ###--disable-ai-models
   
   --fog-disable
   
   ###--disable-skyblend
   
   ###--log-level=debug
  
The item --prop:/sim/hud/draw-fps=true requires some code to be 'imported' from circa 0.9.9-pre3 ... the small block of code is given below ...
Also, due to a bothersome problems that my joystick throttle slider always appears to have some residual value when I start FlightGear - I can remove it, if I blip the throttle up and down very late in the load - I also add a little bit of code to UFO.cxx ...
   When this was discussed on the board recently another developer came up with what he thought
   was a better idea - to relate the maximum speed to the aircraft flaps, and implemented this
   using nasal, and added a property value - 
   
   Speed_Max(fgGetNode("/engines/engine/speed-max-mps", true))
   
 but this does nothing for my start-up problem ... ;=(( Here is a diff -u patch of
   my changes -
  
   --- \fgcvs\flightgear\source\src\FDM\ufo.cxx Sat Mar 11 18:05:17 2006
   
   +++ UFO.cxx Thu Apr 06 15:33:44 2006
   
   @@ -96,7 +96,13 @@
   
   + Rudder * (1 - rudder_damp);
  
   // the velocity of the aircraft
   
   - double velocity = Throttle * Speed_Max->getDoubleValue(); // meters/sec
   
   + double mps = Speed_Max->getDoubleValue();
   
   + double velocity = Throttle * mps; // meters/sec
   
   + if (globals->get_controls()->get_gear_down()) {
   
   + if( mps > 10.0 ) {
   
   + velocity = Throttle * 10;
   
   + }
   
   + }
  
At least with this patch, the UFO.cxx starts up with a very small maximum velocity, and the changing of the maximum is through the G/g (gear up/down) keys ... very simple and easy ...
Here is a screen shot, from the UFO, overlooking San Francisco, with the Golden Gate bridge in the right background ...
    
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
This zip, MD5 (msvc8rt.zip) = e8350ece8559b20b7a41b46f2022ffab, contains the WIN32 Release binary (EXE), and the DLLs used to run it ... You should be able to un-zip this into a folder, and run FlightGear.exe from that folder ... as mentioned above, installing DLLs can be easy. Normally everything should work with the DLLS in the SAME folder as FlightGear.exe, but you may have to copy them to your 'system' folder, usually c:\WINDOWS\System32, as least for the AL (sound) DLLs ...
This ZIP file contains all the SLN/VCPROJ files used, with the above folder structure ... Below is the contents of the make files to 'install' the DLLs ...
A word on C++ deployment, re-distribution of MSVC8 applications. From what I understand, this binary EXE file will ONLY run on windows systems that have MSVCR80.DLL (and MSVCP80.DLL, MSVCM80.DLL, the so called CRT DLLs) installed - part of NET Framework 2.0, and manifests ...
Although this application, and ALL the static and dynamic libraries WERE compiled with /MT, which links using the static multithreaded library LIBCMT.LIB, trying to run it on say WIN98 still produces the 'missing MSVCR80.DLL' dialog ... these links, http://www.codeproject.com/cpp/vcredists_x86.asp, http://blogs.msdn.com/michkap/articles/478235.aspx, and others, will give you ALL the details ;=)) with the topic of C++ deployment in Visual C++ 2005. IT IS NO LONGER AS EASY as just sharing the file(s) ;=((
   The following shows the contents of two make files, which I call update.mak. If placed in the
   AL and pthreads folders respectively, these make files can be run with the command line -
   
   > nmake /nologo /f update.mak CFG=Release all
   
   and the DLLs can be REMOVED with the command -
   
   > nmake /f update.mak clean
  
   OpenAL MAKEFILE - update.mak
   
   # OpenAL update makefile
  
   !IF "$(CFG)." == "."
   
   CFG=Release
   
   !MESSAGE No configuration specified. Defaulting to release.
   
   !ENDIF
  
   dest  =      C:\WINDOWS\System32
   
   vers  =      $(CFG)
   
   des6  =      $(dest)\OpenAL32.dll
   
   des7  =      $(dest)\alut.dll
   
   des8  =      $(dest)\wrap_oal.dll
   
   src6  =      openal\win\Router\$(vers)\OpenAL32.dll
   
   src7  =     
   openal\alut\admin\VisualStudioDotNET\alut\$(vers)\alut.dll
   
   src8  =      openal\win\OpenAL32\$(vers)\wrap_oal.dll
  
all: $(des6) $(des7) $(des8)
   clean:
   
         if EXIST $(des6) del $(des6) > nul
   
         if EXIST $(des7) del $(des7) > nul
   
         if EXIST $(des8) del $(des8) > nul
  
   $(des6):      $(src6)
   
         copy $(src6) $(des6) > null
  
   $(des7):      $(src7)
   
         copy $(src7) $(des7) > null
  
   $(des8):      $(src8)
   
         copy $(src8) $(des8) > null
  
# eof
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
   And a similar one for pthreadVC2.dll - update.mak
   
   # pthreads update makefile
  
   !IF "$(CFG)." == "."
   
   CFG=Release
   
   !MESSAGE No configuration specified. Defaulting to release.
   
   !ENDIF
  
   dest  =      C:\WINDOWS\System32
   
   vers  =      $(CFG)
   
   des1  =      $(dest)\pthreadVC2.dll
   
   src1  =      $(vers)\pthreadVC2.dll
  
all: $(des1)
   clean:
   
         if EXIST $(des1) del $(des1) > nul
  
   $(des1):      $(src1)
   
         copy $(src1) $(des1) > nul
   
   # eof
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
Code for drawing the frame rate text, showing where it is inserted in cockpit.cxx -
   // FIXME: inefficient
   
   if ( hud_visibility_node->getBoolValue() ) {
   
     // This will check the global hud linked list pointer.
   
     // If there is anything to draw it will.
   
     fgUpdateHUD();
   
   }
  
   #ifdef ADD_FPS_STRING
   
   if ( fgGetBool( "/sim/hud/draw-fps", false ) ) {
   
     char buf[64];
   
     float fps = get_frame_rate();
   
     float width = iwidth;
   
     sprintf(buf,"%-5.1f", fps);
  
     glMatrixMode( GL_PROJECTION );
   
     glPushMatrix();
   
     glLoadIdentity();
   
     gluOrtho2D( 0, iwidth, 0, iheight );
   
     glMatrixMode( GL_MODELVIEW );
   
     glPushMatrix();
   
     glLoadIdentity();
  
     glDisable( GL_DEPTH_TEST );
   
     glDisable( GL_LIGHTING );
   
     glColor3f( 0.9, 0.4, 0.2 );
  
     guiFnt.drawString( buf,
   
       int(width - guiFnt.getStringWidth(buf) - 10),10 );
   
     glEnable( GL_DEPTH_TEST );
   
     glEnable( GL_LIGHTING );
   
     glMatrixMode( GL_PROJECTION );
   
     glPopMatrix();
   
     glMatrixMode( GL_MODELVIEW );
   
     glPopMatrix();
   
   }
   
   #endif // ADD_FPS_STRING
  
   glViewport( 0, 0, iwidth, iheight );
   
   Of course, to compile this code add
   
   #define ADD_FPS_STRING
   
   near the top of the file ...
  
top, Folders, freeglut, PLIB, OpenAL, zlib, SimGear, FlightGear, running, downloads ... index
For an alternative folder structure, more closely matching that of the DSW/DSP files in the CVS source of FlightGear, try this simple README.MSVC8.txt ...