Bookmarks: Preamble, CVS Note, Building: zlib, pthreads, openal, freeglut, plib, simgear, flightgear, and running flightgear, downloads.
This is a nice screen shot of the golden gate bridge, with the city in the background, with the (partially transparent) ufo in the view, taken from a position and angle that could perhaps only be achieved in the ufo ;=))
If you can read it, you can see my system was maintaining a frame rate of 37 frames per second at the time of the screen shot. I have seen numbers of over 80 frames per second.
This is a build of FlightGear and its dependant components using Microsoft Visual C++ Express 2005 (MSVC8), in a Windows XP SP2 machine.
The free 'Express' edition of MSVC8 can be downloaded from http://msdn.microsoft.com/vstudio/express/visualc/ ... As far as I can tell the only 'missing' item from this 'Express' version is the ability to edit resource files (.rc). Otherwise, it appears very complete, including the very powerful 'inteli-sense' and dynamic help ...
For this build, I chose a root folder, FG0910-4, in my new Maxtor (6Y120MO) 120GB drive, F:, so it is in F:\FG0910-4. ... my folder structure is given below ...
I had copied my C:\FGCVS - where used to do the cvs (or svn - Subversion - version control system) updates of various sources, if available - to F:\FGCVS, but had some initial trouble - warnings and refusals - with the cvs updates until I set the following items in the environment of the command window -
HOMEDRIVE=F: HOMEPATH=\FGCVS CVSPATH=F:\FGCVS
Then, and only then, would the cvs source update without warning with the simple command 'cvs up -dP' ... svn worked without any problems in the new folder ...
Downloaded zlib-1.2.3.tar.gz (496,597 bytes) from http://www.zlib.net/, and unpacked the files into zlib-1.2.3, the default path in the 'tar' file ... It comes with a MSVC8 solution file - F:\FG0910-4\zlib-1.2.3\contrib\vstudio\vc8\zlibvc.sln - so loaded this into MSVC8.
It contained 6 projects - miniunz, minizip, testzlib, TestZlibDll, zlibstat, and zlibvc. The first thing I check is the runtime library for the static library. At first the Property Pages for zlibstat refused to open - operation could not be completed. I had to change the 'Solution Platform' to Win32 first. It seems MSVC8 Express can not handle the default 'Itanium' build ... The default runtime is Multi-Threaded (/MT and /MTd) ...
Since, for FlightGear I only actually need the 'static' library, that is zlibstat, I 'unloaded' the other 5 projects, but I probably could have just 'unchecked' them in the build manager. I am a bit shocked by the 'Additional Include Paths' pointing to masmx86, although there is a configuration 'ReleaseWithoutAsm', but in compiling the Debug and Release builds, there seems to be no ASM step?
I end up with two static libraries -
Directory of F:\FG0910-4\zlib-1.2.3\contrib\vstudio\vc8\x86\ZlibStatDebug 23/07/2006 08:07 PM 616,876 zlibstat.lib Directory of F:\FG0910-4\zlib-1.2.3\contrib\vstudio\vc8\x86\ZlibStatRelease 23/07/2006 08:04 PM 161,934 zlibstat.lib
But later, when linking FlightGear, the linker failed to find _gzopen, _gzclose, etc. I tried many things, to so far, nothing worked. So I made another copy of the source into F:\FG0910\zlib6, and decided to try using MSVC6 to compile this library. After unloading the example, and minigzip projects, I had -
Also altered the runtime library - Project -> Settings... -> Project Settings -> Win32 LIB Debug -> C/C++ -> Category: Code Generation -> Use run-time library to 'Multithreaded Debug'. Likewise with Win32 LIB Release to 'Multithreaded' ...
This produced two static libraries -
Directory of F:\FG0910-4\zlib6\projects\visualc6\Win32_LIB_Debug 27/07/2006 12:15 PM 206,136 zlibd.lib Directory of F:\FG0910-4\zlib6\projects\visualc6\Win32_LIB_Release 27/07/2006 12:15 PM 100,730 zlib.lib
This work like a charm. Emboldened, I decided to try MSVC7! Making another copy of the source into a folder zlib7, but I load MSVC7 from the zlib.dsw and let it convert it, rather than using the provided VC7 solutions file. TO be sure I remove all but the zlib project, set the runtime to /MT[d], and in the Build -> Configuration Manager, deselect all the 'Active Solution Configuration' except 'LIB Debug' and 'LIB Release' ...
This produces -
Directory of F:\FG0910-4\zlib7\projects\visualc6\Win32_LIB_Debug 27/07/2006 12:37 PM 227,838 zlibd.lib Directory of F:\FG0910-4\zlib7\projects\visualc6\Win32_LIB_Release 27/07/2006 12:37 PM 103,464 zlib.lib
And these link with FlightGear FINE ... so back to MSVC8 ...
This suggests some is DIFFERENT about the 'solution; files provided. As I final test, I re-build zlib-1.2.3 using MSVC8, but starting with the zlib.dsw, and let MSVC8 'convert' this ... of course, in the Build -> Project Manager I disable (uncheck) all but LIB Debug/LIB Release; set the runtime to /MT[d], and add the preprocessor define _CRT_SECURE_NO_DEPRECATE to not see that UGLY message ...
Of course, I end up with the usual two static libraries -
Directory of F:\FG0910-4\zlib-1.2.3\projects\visualc6\Win32_LIB_Debug 27/07/2006 12:54 PM 251,208 zlibd.lib Directory of F:\FG0910-4\zlib-1.2.3\projects\visualc6\Win32_LIB_Release 27/07/2006 12:52 PM 102,902 zlib.lib
AND I HAVE NO PROBLEM WITH THE FLIGHTGEAR LINK. At the moment I do not have time to explore what has been changed in the provided MSVC8 solution file, but it is interesting to note, not all that is newer is better for your purpose ;=))
Note this item is OPTIONAL. SimGear and FlightGear can be compiled without the switch ENABLE_THREADS, and then this DLL is NOT required.
The CVS source is available. I use a command line version of cvs, but this site offers WinCVS links, should you choose that. They offer the intitial 'checkout' information, which I shall not repeat here, since this may change. After the initial 'checkout', a quick 'cvs up -dP' updates the source, but have not seen many changes in the last many months.
pthreads does not have a MSVC8 solution file, but it does have a pthreads.DSW, a MSVC6 file which MSVC8 can load and convert ... there is only one project, and it is a Dynamic Link Library ... I find that the runtime libraries are set to Multi-Threaded DLL (/MD and /MDd) ... I change this to the runtime of my choice, /MT and /MTd respectively, but this is perhaps not so important for a DLL project.
I get the UGLY warning about a depreciated function, so I add _CRT_SECURE_NO_DEPRECATE to the 'Pre-processor' defines to remove this 'warning'. And I get the error -
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'.
To 'fix' this I change the pthreads property pages -> Linker -> Manifest File -> Generate Manifest from 'Yes' to 'No' in both the Debug and Release configurations ... then checking just the Release in the Batch Build manager, I get the following new files ... I only want the 'Release' version of this DLL (and library) ...
Directory of F:\FG0910-4\pthreads 23/07/2006 08:45PM 77,824 pthreadVC2.dll 23/07/2006 08:45PM 29,056 pthreadVC2.lib
It is lucky that I only want the 'Release' version, because both configuration are created in the SAME PLACE, so one overwrites the other. If you do want the 'Debug' version of the DLL you would have to modify the output path of file name ...
This SOUND library consists of two(2) parts - (1) OpenAL itself and (2) ALUT, and both are implemented as DLLs. The source download can be via SVN, which I use, but they also have a Windows Installer version to download and install the DLLs directly into your machine, and an OpenAL SDK to get the headers and sources ... Since I have never tried these latter options, I can not comment on what you get.
The first time SVN download could not be easier, with a command like -
svn co http://www.openal.org/repos/openal/trunk
But check the OpenAL site for the latest. They now make it clear that all you really need is this 'trunk' source - I downloaded the whole shebang - many tagged and branch version included - my first time, but this just wastes disk space ;=))
They have MSVC solution file for each part -
Directory of F:\FG0910-4\openal\alut\admin\VisualStudioDotNET 05/06/2006 02:29 PM 1,968 alut.sln Directory of F:\FG0910-4\openal\OpenAL-Windows 05/06/2006 02:29 PM 4,342 OpenAL.sln
(1) OpenAL Build
Loading the OpenAL.sln file reveals 4 projects -
On my first (Debug configuration) build I got two(2) ERRORS -
(i.) Compiling resources... .\OpenAL32.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'.
(ii.) alc.cpp f:\fg0910-4\openal\openal-windows\router\alc.cpp(35) : fatal error C1083: Cannot open include file: 'atlconv.h': No such file or directory
(i.) afxres.h
I locate a number of VERSIONS of this file -
Directory of C:\cygwin\usr\include\w32api 17/01/2006 08:53 PM 324 afxres.h Directory of C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\mfc 03/03/2006 11:20 PM 32,988 AFXRES.H Directory of C:\Program Files\Microsoft Platform SDK for Windows XP SP2\Samples\NetDS\ADSI\samples\General\DsBrowse\bitmaps 21/03/2004 08:39 AM 24,480 afxres.h Directory of C:\Program Files\Microsoft Visual Studio\VC98\MFC\Include 29/01/2003 04:00 PM 32,525 AFXRES.H Directory of C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include 13/07/2002 02:35 AM 34,297 afxres.h
Of course, the version I want is part of the latest SDK, namely in Microsoft Platform SDK for Windows Server 2003 R2. I check in MSVC8, under Tools -> Options ... -> Projects and Solutions -> VC++ Directories -> Platform: Win32 -> Show directories for: Include files, I note that - C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\include - is already in there, but NOT - C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\include\mfc ...
I add this, as the last in my list ...
(ii.) atlconv.h
Likewise, I find several version of atlconv.h in my system -
Directory of C:\NTDDK\inc\ 27/07/2000 06:14 AM 13,265 atlconv.h Directory of C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\atl\ 03/03/2006 11:19 PM 34,481 atlconv.h Directory of C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\src\mfc\ 03/03/2006 11:19 PM 13,254 atlconv.h Directory of C:\Program Files\Microsoft Visual Studio\VC98\ATL\Include\ 29/01/2003 04:00 PM 13,263 ATLCONV.H Directory of C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\ 13/07/2002 02:35 AM 27,708 atlconv.h
As above, I only need to add -
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\atl
to the end of the list ...
I also get a Linker WARNING -
Linking... alBuffer.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
This can probably be ignored, or it can be 'fixed' by changing OpenAL and Router Property Pages -> Linker -> General -> Enable Incremental Linking, from 'No' to 'Default' ... in the past this 'incremental' linker was turned off my many users to ensure a NEW DLL was linked each time - this was promoted by the fact that sometimes the dependencies, or other things in the 'Studio' failed, but I think most of these have been fixed. If ever I am unsure, I will manually delete the DLL to force a new complete link ;=()
When the build is completed, I have a list of DLL files -
Directory of F:\FG0910-4\openal\OpenAL-Windows\OpenAL32\Debug 24/07/2006 06:47 PM 544,768 wrap_oal.dll Directory of F:\FG0910-4\openal\OpenAL-Windows\OpenAL32\Release 24/07/2006 06:55 PM 188,416 wrap_oal.dll Directory of F:\FG0910-4\openal\OpenAL-Windows\Router\Debug 24/07/2006 06:47 PM 458,752 OpenAL32.dll Directory of F:\FG0910-4\openal\OpenAL-Windows\Router\Release 24/07/2006 06:55 PM 102,400 OpenAL32.dll
And a list of associated library files -
Directory of F:\FG0910-4\openal\OpenAL-Windows\Alc\Debug 24/07/2006 06:22 PM 140,686 ALc.lib Directory of F:\FG0910-4\openal\OpenAL-Windows\Alc\Release 24/07/2006 06:55 PM 49,616 ALc.lib Directory of F:\FG0910-4\openal\OpenAL-Windows\Alu\Debug 24/07/2006 06:22 PM 43,632 ALu.lib Directory of F:\FG0910-4\openal\OpenAL-Windows\Alu\Release 24/07/2006 06:55 PM 11,200 ALu.lib Directory of F:\FG0910-4\openal\OpenAL-Windows\OpenAL32\Debug 24/07/2006 06:47 PM 20,328 wrap_oal.lib Directory of F:\FG0910-4\openal\OpenAL-Windows\OpenAL32\Release 24/07/2006 06:55 PM 20,328 wrap_oal.lib Directory of F:\FG0910-4\openal\OpenAL-Windows\Router\Debug 24/07/2006 06:47 PM 20,004 OpenAL32.lib Directory of F:\FG0910-4\openal\OpenAL-Windows\Router\Release 24/07/2006 06:55 PM 20,004 OpenAL32.lib
Unless pushed, normally I will only use the RELEASE version of these shared libraries (DLL) ...
(2) ALUT Build
Loading the ALUT.sln reveals it is version MSVC7, so I do an in-place conversion to MSVC8. Three projects are shown -
Although alut is a DLL project, I note the alut Property Pages -> C/C++ -> Code Generation -> Runtime Library is set to 'Multi-threaded [Debug] DLL (/MD[d]), and is my habit, I amend this to /MT[d] ... for all three projects, for each configuration - Debug and Release. I have yet to explore whether this is IMPORTANT in a DLL context, but to be consistent and SURE, I always make this change.
Initially, nothing builds due to the repeated ERROR -
Compiling... alutBufferData.c f:\fg0910-4\openal\alut\include\al\alut.h(5) : fatal error C1083: Cannot open include file: 'alc.h': No such file or directory
Since I know alut.h exists, this must be due to the value in Property Pages -> C/C++ -> General -> Additional Include Directories, and sure enough, in there I find only a reference to the OpenAL SDK folder, which I have NOT downloaded or installed ...
C:\Program Files\OpenAL 1.1 with EFX SDK\include;..\..\..\include
The alut.vcproj file is in -
Directory of F:\FG0910-4\openal\alut\admin\VisualStudioDotNET\alut
And the alc.h is in -
Directory of F:\FG0910-4\openal\include\AL
So I correct the 'Additional Include Directories' to -
..\..\..\..\include\AL;..\..\..\include
Of course, up pops the UGLY 'depreciation' warning, so as usual I add ' _CRT_SECURE_NO_DEPRECATE' ;=)) Another case for building a Perl script to do this ...
And on the LINK, I get the ERROR -
Linking... LINK : fatal error LNK1104: cannot open file 'openal32.lib'
Since I have just finished build this DLL with its associated libray, I again 'know' it exists, and this must check alut Property Pages -> Linker -> General -> Additional Library Directories. Sure enough, again there is a reference to the SDK I do not have ...
C:\Program Files\OpenAL 1.1 with EFX SDK\libs\Win32
I correct this to -
..\..\..\..\OpenAL-Windows\Router\Release
As mentioned above, normally I will only use the RELEASE version of DLLS ... As is becoming common, I still get the 'manifest' error -
Linking... Creating library Debug/alut.lib and object Debug/alut.exp 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'.
There must be a way to 'fix' this, but for now I just 'disable' the generation of a manifest ...
This gets ALUT.DLL built, and I have to apply some similar 'fixes' to the other two projects - hello_world and playfile ... although these are NOT important for flightgear ...
After the alut build, I have 2 DLLS
Directory of F:\FG0910-4\openal\alut\admin\VisualStudioDotNET\alut\Debug 24/07/2006 07:40 PM 593,920 alut.dll Directory of F:\FG0910-4\openal\alut\admin\VisualStudioDotNET\alut\Release 24/07/2006 07:48 PM 126,976 alut.dll
And 2 associated libraries -
Directory of F:\FG0910-4\openal\alut\admin\VisualStudioDotNET\alut\Debug 24/07/2006 07:40 PM 5,922 alut.lib Directory of F:\FG0910-4\openal\alut\admin\VisualStudioDotNET\alut\Release 24/07/2006 07:48 PM 5,922 alut.lib
As stated earlier however, in general, for DLLS I only use the RELEASE configuration, unless really pushed to do otherwise ...
I was hoping to avoid using this, but it seems the GL folder containing glut.h is no longer shipped as part of the Microsoft SDK - Microsoft Platform SDK for Windows Server 2003 R2 - It was include with MSVC7 and earlier version.
It does not have a MSVC8 solution file, but loading and converting the MSVC6 freeglut.dsw reveals 2 projects. But I am only interested in the static library version, so I unload the DLL project -
Checking the runtime library it defaults to what I want, /MT[d], but as with all 'converted' projects it is necessary to add ' _CRT_SECURE_NO_DEPRECATE' to the preprocessor definitions unles you want the UGLY 'depreciation' warning to be emitted.
The build of both Debug and Release configuration proceeds smoothly and quickly, and I am left with two(2) new static libraries ...
Directory of F:\FG0910-4\freeglut\DebugStatic 26/07/2006 03:36 PM 1,100,442 freeglut_static.lib Directory of F:\FG0910-4\freeglut\ReleaseStatic 26/07/2006 03:36 PM 502,146 freeglut_static.lib
Looking in GL\glut.h I note it is only 'including' freeglut_std.h. There is also a freeglut_ext.h, but for the present I will assume I do not need these 'extensions'? Also looking in free_glut_std.h, I note it is using a 'pragma' to include this static library only if FREEGLUT_STATIC is defined -
/* Link with Win32 static freeglut lib */ # if defined(_MSC_VER) || defined(__WATCOMC__) # pragma comment (lib, "freeglut_static.lib") # endif
Else it will use the windows shared (DLL) library.
And under a self explaining comment, it also 'forces' a group of other shared (DLL) libraries, namely -
/* Drag in other Windows libraries as required by FreeGLUT */ # if defined(_MSC_VER) || defined(__WATCOMC__) # ifndef _WIN32_WCE # pragma comment (lib, "winmm.lib") /* link Windows MultiMedia lib */ # pragma comment (lib, "user32.lib") /* link Windows user lib */ # pragma comment (lib, "gdi32.lib") /* link Windows GDI lib */ # pragma comment (lib, "opengl32.lib") /* link Microsoft OpenGL lib */ # pragma comment (lib, "glu32.lib") /* link OpenGL Utility lib */ # endif /* _WIN32_WCE */ # endif
The latest stable version can be downloaded as plib-1.8.4.tar.gz, or the development cvs version, which I use. It does not have a MSVC8 solution file, but there is a plib.dsw file that can be loaded, and converted. This shows 13 projects - I set the 'plib' project as the 'Start Up' project -
To avoid the UGLY MSVC8 'depreciation' you must select each of the 12 static library projects, and add the _CRT_SECURE_NO_DEPRECATE to Property Pages -> C/C++ -> Preprocessor -> Preprocessor Definitions, after a ';' separation character, for both the Debug and Release configurations. I keep 'threatening' myself that I should write say a Perl script to effect this change, since it happens every time there is a conversion from MSVC6!
The compile yields a few warnings, which I ignore, but also a few ERRORS, which must be fixed.
The ERROR -
ssgSaveAC.cxx .\ssgSaveAC.cxx(93) : error C2440: 'initializing' : cannot convert from 'const char *' to 'char *' Conversion loses qualifiers .\ssgSaveAC.cxx(99) : error C2440: '=' : cannot convert from 'const char *' to 'char *' Conversion loses qualifiers
had already been 'fixed' under an #ifdef UL_BB switch.
I note that in 'ul.h' that UL_MSVC, along with UL_WIN32 is defined per the following code fragment -
#elif defined(_WIN32) || defined(__WIN32__) || defined(_MSC_VER) #define UL_WIN32 1 #define UL_MSVC 1 /* Windoze AND MSVC. */
So, some 'fixes' can be effected by changing -
#ifdef UL_BB
to
#if ( defined(UL_BB) || defined(UL_MSVC) )
The next set of ERRORS are more difficult to 'fix' -
puVerticalMenu.cxx .\puVerticalMenu.cxx(27) : error C2653: 'puVerticalMenu' : is not a class or namespace name .\puVerticalMenu.cxx(27) : error C2065: 'RTTI_obj' : undeclared identifier .\puVerticalMenu.cxx(27) : error C2673: 'RTTI_cast' : global functions do not have 'this' pointers .\puVerticalMenu.cxx(27) : error C2352: 'puGroup::RTTI_cast' : illegal call of non-static member function f:\fg0910-4\plib\src\pui\pu.h(847) : see declaration of 'puGroup::RTTI_cast'
This comes from expanding a MACRO like -
UL_RTTI_DEF1(puVerticalMenu,puGroup)
This MACRO invokes two other macros -
#define UL_RTTI_DEF1(cls,b1) \ UL_RTTI_DEF1_BASE(cls,b1) \ UL_RTTI_NO_NEW(cls)
I had once before TRIED to find a 'fix' for this compile problem, and this time, like that time, COULD NOT FIND A SOLUTION!
To be able to get on with the PLIB compile, I chop these files from the PUI static library - puBiSlider.cxx, puComboBox.cxx, puFileSelector.cxx, puLargeInput.cxx, puScrollBar.cxx, puSelectBox.cxx, puSpinBox.cxx, puTriSlider.cxx, and puVerticalMenu.cxx. In a static library this will be NO PROBLEM provided NONE of these functions are used in SimGear or FlightGear ... keep my fingers CROSSED ;=))
I still get a few WARNINGS, of the type -
ssgLoadASE.cxx .\ssgLoadASE.cxx(324) : warning C4996: 'strnicmp' was declared deprecated c:\Program Files\Microsoft Visual Studio 8\VC\include\string.h(215) : see declaration of 'strnicmp' Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strnicmp. See online help for details.'
but choose to ignore these ... ;=))
The PLIB build does a neat trick of COPYING the needed libraries, and associated header files, to the root of the PLIB folder. So the list of files available when the build is completed is -
Directory of F:\FG0910-4\PLIB 24/07/2006 05:50 PM 231,942 fnt.lib 24/07/2006 02:12 PM 230,636 fnt_d.lib 24/07/2006 05:50 PM 15,486 js.lib 24/07/2006 02:12 PM 153,976 js_d.lib 24/07/2006 05:50 PM 69,716 net.lib 24/07/2006 02:16 PM 263,970 net_d.lib 24/07/2006 05:50 PM 572,648 psl.lib 24/07/2006 02:12 PM 631,544 psl_d.lib 24/07/2006 05:50 PM 1,227,698 puAux.lib 24/07/2006 02:11 PM 1,273,446 puAux_d.lib 24/07/2006 05:50 PM 1,210,448 pui.lib 24/07/2006 02:16 PM 1,237,232 pui_d.lib 24/07/2006 05:49 PM 17,744 pw.lib 24/07/2006 01:19 PM 54,410 pw_d.lib 24/07/2006 05:49 PM 378,354 sg.lib 24/07/2006 01:19 PM 400,106 sg_d.lib 24/07/2006 05:49 PM 538,582 sl.lib 24/07/2006 01:19 PM 499,886 sl_d.lib 24/07/2006 05:49 PM 5,434,666 ssg.lib 24/07/2006 05:48 PM 1,163,144 ssgAux.lib 24/07/2006 01:17 PM 1,204,644 ssgAux_d.lib 24/07/2006 02:11 PM 5,388,218 ssg_d.lib 24/07/2006 05:47 PM 163,622 ul.lib 24/07/2006 01:17 PM 164,880 ul_d.lib
Also note how they are in PAIRS, like fnt.lib and fin_d.lib, being the RELEASE and DEBUG versions, respectively. These are now ready to link with SimGear and FlightGear ...
In establishing the simgear folder, in F:\FG0910-4, I remember to drop one of the folders names. The cvs of simgear updates into simgear\source, which I XCOPY into just simgear. SimGear now had a MSVC8 solution file, in F:\FG0910-4\simgear\projects\VC8\SimGear.sln which I load into MSVC8.
This shows only 1 project -
I check the runtime library is set to /MT[d], and take a look at the Preprocessor Definitions -
WIN32;NDEBUG;_WINDOWS;HAVE_CONFIG_H;ENABLE_THREADS;_CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS;NOMINMAX;_USE_MATH_DEFINES
Since I decide this build is to be without 'pthreads' I REMOVE the 'ENABLE_THREADS' ... I also 'know' to look in F:\FG0910-4\simgear\simgear\simgear_config.h.vc5, which will be copied to simgear_config.h during the DEBUG build. I note it contains a few things that may cause warnings ...
It defines WIN32 with -
#define WIN32 1
which may, in certain circumstances generate a warning about the 'redefinition' of WIN32. Note it is in the preprocessor defines, which defines it as TRUE, while this file defines it as 1. While they have the same effect, sometimes the compile will issue a warning ...
Similarly with NOMINMAX, which it also defines as -
#define NOMINMAX 1
Also, the 'Additional Include Directories' will need some modification. It presently shows -
../..;../../..;../../Simgear; ../../../AL/include; "../../../zlib-1.2.3"; "../../../Pre-built.2/include"
Dealing with them 1 by 1
i. ../.. - This is a relative reference to F:\FG0910-4\simgear, so looks ok.
ii. ../../.. - This is a relative reference to F:\FG0910-4, so look ok for PLIB items.
iii. ../../Simgear - This is a local internal reference, and looks ok.
iv. ../../../AL/include - My OpenAL has to be - ..\..\..\OpenAL\include
v. ../../../zlib-1.2.3 - This looks correct for zlib
vi. ../../../Pre-built.2/include - Since I am NOT using pthreads, this can be removed.
vii. none - I will also need a reference to alut.h, or more precisely AL\alut.h, so add ..\..\..\OpenAL\alut\include
viii. none - Since alut.h include alc.h, and not AL\alc.h, then must also have a reference to ..\..\..\OpenAL\include\AL
This gives me the following ... without the spaces ...
../..;../../..;../../Simgear; ../../../OpenAL/include; ../../../zlib-1.2.3; ..\..\..\OpenAL\alut\include; ..\..\..\OpenAL\include\AL
Since changing this string will cause a complete re-build of all files, it is important to try to get it fully correct the first time ;=()
During the compile of SimGear, I tried adding the following block into the _MSC_VER section of compiler.h, to see if I could remove some other 'depreciation' warnings. This worked well for the compile of SimGear, but caused BIG PROBLEMS with the compile of FlightGear, so added the optional conditional switch ;=() And I had to return here, and re-compile simgear ;=((
#if _MSC_VER >=1400 // msvc++ 8.0 or greater #ifdef USE_UNDERSCORE_FUNCTIONS #define open _open // this and other used in SimGear #define read _read #define lseek _lseek #define write _write #define close _close #define strdup _strdup #define stricmp _stricmp // used in FlightGear #endif // #ifdef USE_UNDERSCORE_FUNCTIONS #pragma warning(disable: 4996) // like '_write' was declared deprecated # endif
I did make one small change in the simgear source, in the SGThread.[cxx|hxx] files. I added a block -
#ifdef ENABLE_THREADS ... #endif /* #ifdef ENABLE_THREADS */
basically around the whole file. Yes, I could have excluded SGThread.cxx from the build, but at the time this seemed an 'easier' alternative that would allow me to simply add a define of ENABLE_THREADS and I could quickly re-compile it using pthreads.
Like SimGear, and others, in establishing the flightgear folder - F:\FG0190-4\flightgear, I 'drop' one folder depth when copying the cvs source. My cvs download and update is to F:\FGCVS\flightgear\source, so the XCOPY command is -
xcopy /E f:\FGCVS\flightgear\source\*.* f:\FG0190-4\flightgear\.
FlightGear also now has a MSVC8 solution file, in -
Directory of F:\FG0910-4\flightgear\projects\VC8 24/03/2006 08:11 PM 1,507 FlightGear.sln
Loading this in MSVC8, it shows 2 projects -
The first, FlightGear is the main console application (EXE), and FlightGearLib is the many, many sources ... naturally the EXE is dependant on a static library, so both MUST be built ... Of course I also check the runtime library is set to /MT[d] ...
But first to check what options are enabled. From the respective Property Pages -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions, I note -
Debug Main:
WIN32; _DEBUG; _WINDOWS; ENABLE_THREADS; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; NOMINMAX; FREEGLUT_STATIC
Debug Library:
WIN32;_DEBUG; _WINDOWS;ENABLE_THREADS; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; _USE_MATH_DEFINES; NOMINMAX; FREEGLUT_STATIC
Release Main:
WIN32;NDEBUG; _CONSOLE; ENABLE_THREADS; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; _USE_MATH_DEFINES; NOMINMAX; FREEGLUT_STATIC
Release Library:
WIN32;NDEBUG; _WINDOWS; PTW32_STATIC_LIB; ENABLE_THREADS; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; _USE_MATH_DEFINES; NOMINMAX; FREEGLUT_STATIC
In this case I am NOT using 'pthreads' so remove 'ENABLE_THREADS', and I note the 'FREEGLUT_STATIC' has been included. I also remove the 'PTW32_STATIC_LIB', since I am not sure what this does exactly - assume builds static library - but it is only used in the pthread source which I am excluding here.
And it seems 'FGFS' is MISSING? While this is defined in config.h, not every file includes config.h first, like FGEngine.cpp -
#ifdef FGFS # include <simgear/compiler.h> # ifdef SG_HAVE_STD_INCLUDES # include <fstream> # else # include <fstream.h> # endif #else # if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740) # include <fstream.h> # else # include <fstream> # endif #endif
Debug Main:
WIN32; _DEBUG; _WINDOWS; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; NOMINMAX; FREEGLUT_STATIC; FGFS
Debug Library:
WIN32; _DEBUG; _WINDOWS; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; _USE_MATH_DEFINES; NOMINMAX; FREEGLUT_STATIC; FGFS
Release Main:
WIN32; NDEBUG; _CONSOLE; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; _USE_MATH_DEFINES; NOMINMAX; FREEGLUT_STATIC; FGFS
Release Library:
WIN32; NDEBUG; _WINDOWS; HAVE_CONFIG_H; _CRT_SECURE_NO_DEPRECATE; _CONST_CORRECT_OVERLOADS; _USE_MATH_DEFINES; NOMINMAX; FREEGLUT_STATIC; FGFS
But I also 'know' to look in the file config.h-msvc8 - see the Pre-build Event -
copy ..\..\src\Include\config.h-msvc8 ..\..\src\Include\config.h
And sure enough in there I find -
#define ENABLE_THREADS 1
which I comment out ...
Again I also note the line -
#define WIN32 1
As mentioned above, this may lead to a compiler warning, like 'redefinition' ... for some reason known only to itself it thinks -
#define WIN32
as comes from the above preprocessor definitions, is different to this defining it as 1 ... and perhaps they are, but the 'effect' is the SAME ...
Then the included libraries - FlightGear Property Pages -> Configuration Properties -> Linker -> Input -> Additional Dependencies -
Debug:
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
Release:
FlightgearLib.lib Simgear.lib fnt.lib js.lib net.lib psl.lib puAux.lib pui.lib pw.lib sg.lib sl.lib ssg.lib ssgAux.lib ul.lib pthreadvc2.lib Alut.lib openal32.lib zlib.lib wsock32.lib advapi32.lib comdlg32.lib shell32.lib user32.lib
Note, because freeglut_std.h already includes, using a '#pragma comment (lib, "name_of_lib.lib")', the libraries freeglut_static.lib, winmm.lib, user32.lib, gdi32.lib, opengl32.lib, and glu32.lib, so these names do NOT need to be included in the above, but it does no harm to repeat one or more of them ...
Adjusted to -
Debug:
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 Alut.lib openal32.lib zlibd.lib wsock32.lib advapi32.lib comdlg32.lib shell32.lib user32.lib
Release:
FlightgearLib.lib Simgear.lib fnt.lib js.lib net.lib psl.lib puAux.lib pui.lib pw.lib sg.lib sl.lib ssg.lib ssgAux.lib ul.lib Alut.lib openal32.lib zlib.lib wsock32.lib advapi32.lib comdlg32.lib shell32.lib user32.lib
Then checking the FlightGear Property Pages -> Configuration Properties -> Linker -> General -> Additional Library Directories, and find - of course, this only applies to the main (EXE) build -
Debug Main:
"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
Release Main:
"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
Dealing with them one at a time -
(i). "FG$(IntDir)" - This points to its own 'library' so this is ok. *
(ii). ../../../plib/ - This gives it access to the PLIB static libraries
(iii). "../../../Simgear/Projects/VC8/$(IntDir)" - Access to SimGear static library *
(iv). "../../../freeglut-2.4.0/$(IntDir)Static" - Access to freeglut_static.lib. I must change this to ..\..\..\freeglut\$(IntDir)Static
(v). "../../../Pre-Built.2/lib" - This represents pthreads, not being used. Removed.
(vi). "../../../zlib-1.2.3/projects/visualc6/win32_lib_asm_$(IntDir)" - This is zlib, and, (see notes above and as shown above), needs to be changed to ..\..\..\zlib-1.2.3\projects\visualc6\Win32_LIB_$(IntDir) *
(vii). ../../../al/lib - This is for OpenAL, and as shown above, I must change this to
..\..\..\openal\OpenAL-Windows\Router\$(IntDir) for OpenAL32.lib, and ..\..\..\openal\alut\admin\VisualStudioDotNET\alut\$(IntDir) for ALUT.lib ...
Debug Main:
"FG$(IntDir)";../../../plib/;"../../../Simgear/Projects/VC8/$(IntDir)"; ..\..\..\freeglut\$(IntDir)Static;..\..\..\zlib-1.2.3\projects\visualc6\Win32_LIB_$(IntDir);..\..\..\openal\OpenAL-Windows\Router\$(IntDir); ..\..\..\openal\alut\admin\VisualStudioDotNET\alut\$(IntDir) Release Main:
Same as above.
* Note this use of $(IntDir) means we can have the same string for both Debug and Release.
Finally checking the FlightGear Property Pages -> Configuration Properties -> C/C++ -> General -> Additional Include Directories -
Debug Main:
../../../; ../../../Simgear; ../../src; ../../../AL/include; ../../../zlib-1.2.3; ../../../freeglut-2.4.0/include; ../../../Pre-built.2/include; ../../src/include; ../../src/input; ../../src/FDM/JSBSim
Release Main:
../../../;../../../Simgear; ../../src; ../../../AL/include; ../../../zlib-1.2.3; ../../../freeglut-2.4.0/include; ../../../Pre-built.2/include; ../../src/include; ../../src/input; ../../src/FDM/JSBSim
Debug Library:
../../../; ../../../Simgear; ../../src; ../../../AL/include; ../../../zlib-1.2.3; ../../../freeglut-2.4.0/include; ../../../Pre-built.2/include; ../../src/include; ../../src/input; ../../src/FDM/JSBSim
Release Library:
../../../; ../../../Simgear; ../../src; ../../../AL/include; ../../../zlib-1.2.3; ../../../freeglut-2.4.0/include; ../../../Pre-built.2/include; ../../src/include; ../../src/input; ../../src/FDM/JSBSim
As expected, these are all the same ... dealing one-by-one ...
(i) ../../../ - This allow includes like <PLIB\ul.h> - ok.
(ii) ../../../Simgear - This allows includes like <simgear\debug\logstream.hxx> - ok.
(iii) ../../src - This allows include like <model\modelmgr.hxx> - ok.
(iv) ../../../AL/include - This is for OpenAL, so must adjust it to ..\..\..\openal\include, for things like <AL\al.h>, and add ..\..\..\openal\include\AL for references like <al.h>, and ..\..\..\openal\alut\include for <AL\alut.h>
(v) ../../../zlib-1.2.3 - Tis is for <zlib.h> - ok.
(vi) ../../../freeglut-2.4.0/include - This is for freeglut, and I must change this to ..\..\..\freeglut\include.
(v) ../../../Pre-built.2/include - This is for pthreads, not being used. Removed.
(vi) ../../src/include - This is for <config.h> - ok.
(vii) ../../src/input - This is for <input.hxx> - ok.
(viii) ../../src/FDM/JSBSim - This is for <JSBSim.hxx> - ok.
So have the following new string -
../../../; ../../../Simgear; ../../src; ..\..\..\openal\include; ..\..\..\openal\include\AL; ..\..\..\freeglut\include; ..\..\..\openal\alut\include; ../../../zlib-1.2.3; ../../src/include;../../src/input; ../../src/FDM/JSBSim
In this first build I get HUNDREDS of warnings, but I tend to ignore these. But, perhaps as no SURPRISE I also get a few ERRORS ;=((
FlightGearLib - 17 error(s), 260 warning(s)
Problems with the following files :
SimGear sgthreads.hxx - since this is unconditionally included by some files, added the following switch around everything ...
#ifdef ENABLE_THREADS ... #endif // #ifdef ENABLE_THREADS
Not an error, but just to stop the 'noise' added the following to the top of basic_aero.c -
#ifdef _MSC_VER #pragma warning (disable: 4101) #endif // _MSC_VER
FGEngine.cpp: With my simgear initial compiler changes, this would not compile. Error about 'open' ...
Fix: This error pointed me to the fact that 'FGFS' had not been add to the preprocessor defines ...
With this FGFS define added, then it included <simgear/compiler.h>, with the following switched code -
#ifdef FGFS # include <simgear/compiler.h> # ifdef SG_HAVE_STD_INCLUDES # include <fstream> # else # include <fstream.h> # endif #else # if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740) # include <fstream.h> # else # include <fstream> # endif #endif
Removed
HUD-lat.cxx
and
HUD-lon.cxx
from the project, and added in the new files from
Instrumentation\HUD folder ... added all cxx files ...
Also had to add
src\Instrumentation\gsdi.cxx and
src\Instrumentation\heading_indicator_fg.cxx ...
In fact I have a neat Perl script which does a COMPARE of the sources of two MSVC8 solution files. The following is it output -
Comparing sorted lists 838 with 851 files... Comparing those in 1 [f:\fgcvs\flightgear\source\projects\vc8\flightgear.sln], with 2 [f:\FG0910-4\flightgear\projects\vc8\flightgear.sln]... No match for [..\..\src\cockpit\hud_lat.cxx] ... No match for [..\..\src\cockpit\hud_lon.cxx] ... This suggests 2 file(s) have been DELETED from 2 ... Reverse compare - Comparing those in 2 [f:\FG0910-4\flightgear\projects\vc8\flightgear.sln], with 1 [f:\fgcvs\flightgear\source\projects\vc8\flightgear.sln]... No match for [..\..\src\Include\config.h-msvc8] ... No match for [..\..\src\Instrumentation\HUD\HUD.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD.hxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_dial.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_gauge.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_instrument.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_label.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_ladder.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_misc.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_runway.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_scale.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_tape.cxx] ... No match for [..\..\src\Instrumentation\HUD\HUD_tbi.cxx] ... No match for [..\..\src\Instrumentation\gsdi.cxx] ... No match for [..\..\src\Instrumentation\heading_indicator_fg.cxx] ... This suggests 15 file(s) have been ADDED to 2 ... Done 838 with 851 file compares ...
I also had some trouble with zlib ... read above about that ...
AND IT COMPILES AND LINKS - HAPPINESS IS IN A GOOD COMPILE AND LINK ;=))
First I have to take care of the install of the 'sound' shared libraries (DLL), else when I run FlightGear I will get something like -
Shared libraries (DLL) can be installed in several ways. They can be copied to the folder from which the applications is being run. This makes them available for ONLY that application, and it must be done this way if there is any conflict of names.
In theory they can be copied to any folder in the PATH environment variable. Mine is quite long, seen by just entering PATH at the command prompt -
PATH="C:\Program Files\Microsoft DirectX SDK (April 2006)\Utilities\Bin\x86"; C:\WINDOWS\system32; C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\MDOS;C:\Perl\bin\;c:\PHP; c:\Program Files\Microsoft SQL Server\90\Tools\binn\; C:\Program Files\ATI Technologies\ATI.ACE\; C:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT; C:\Program Files\Microsoft Visual Studio\Common\Tools; C:\Program Files\Microsoft Visual Studio\VC98\bin
You can see one of the paths shown is what can be called the 'system' folder, namely - C:\WINDOWS\system32 - and this is where I choose to install them. These MSVC8 WIN32 sound shared libraries (DLL) will conflict with cygwin, if you also happen to be building and running this, so I have two batch files - one to copy them to the system folder, and one to delete them again ...
@REM copyall.bat @set TEMPDD=C:\WINDOWS\System32 @if NOT EXIST %TEMPDD%\alut.dll goto COPYALL @if NOT EXIST %TEMPDD%\wrap_oal.dll goto COPYALL @if NOT EXIST %TEMPDD%\OpenAL32.dll goto COPYALL @REM @if NOT EXIST %TEMPDD%\pthreadVC2.dll goto COPYALL @REM @echo Note: alut.dll, wrap_oal.dll, OpenAL32.dll, and pthreadVC2.dll, @echo Note: alut.dll, wrap_oal.dll, and OpenAL32.dll ... @echo already EXIST in %TEMPDD% folder! @echo Any key to continue ... crtl+C to abort batch ... @pause :COPYALL call copy1 alut.dll C:\FG0910-3\openal\alut\admin\VisualStudioDotNET\alut\Release call copy1 wrap_oal.dll C:\FG0910-3\openal\OpenAL-Windows\OpenAL32\Release call copy1 OpenAL32.dll C:\FG0910-3\openal\OpenAL-Windows\Router\Release @REM call copy1 pthreadVC2.dll C:\FG0910-3\pthreads
@REM delall.bat call copy1 alut.dll C:\FG0910-3\openal\alut\admin\VisualStudioDotNET\alut\Release D call copy1 wrap_oal.dll C:\FG0910-3\openal\OpenAL-Windows\OpenAL32\Release D call copy1 OpenAL32.dll C:\FG0910-3\openal\OpenAL-Windows\Router\Release D call copy1 pthreadVC2.dll C:\FG0910-3\pthreads D @echo All done ...
@REM copy1.bat @REM expected command is the DLL name, and its SOURCE folder as two arguments @if "%3." == "." goto DOCOPY @if "%3." == "D." goto DODELETE @if "%3." == "d." goto DODELETE @echo Usage DLL path 'D|d' @goto END :DODELETE @set TEMPDD=C:\WINDOWS\System32 @set TEMP1=%1 @set TEMPD=%TEMPDD%\%TEMP1% @if NOT EXIST %TEMPD% goto NODELETE del %TEMPD% @goto END :NODELETE @echo It appears [%TEMPD%] has already been removed ... @goto END :DOCOPY @set TEMPDD=C:\WINDOWS\System32 @set TEMP1=%1 @set TEMP2=%2 @set TEMPS=%TEMP2%\%TEMP1% @if NOT EXIST %TEMPS% goto ERR1 @set TEMPD=%TEMPDD%\%TEMP1% @if NOT EXIST %TEMPD% goto COPY @echo WARNING %TEMPD% already EXISTS! @DIR %TEMPD% @echo *** OVERWRITE THIS FILE? *** Ctrl+C to ABORT copy ... @pause :COPY copy %TEMPS% %TEMPDD%\. @goto END :ERR1 @echo Can NOT locate file [%TEMPS%] ... check name and source ... @goto END :END
And I generally use a batch file to run FlightGear, which I keep in the F:\FG0190-4 root folder. I have copied the CVS data into a folder called data, so the initial command is -
@set TEMP1=flightgear\projects\VC8\Release\FlightGear.exe @if NOT EXIST %TEMP1% goto ERR1 @set TEMP2=--fg-root=data %TEMP1% %TEMP2% @goto END :ERR1 @echo ERROR: Can not locate [%TEMP1%] executable? Check and re-run ... @goto END :END
AND IT RAN PERFECTLY USING THE DEFAULT CESSNA AIRCRAFT ;=)) ;=)) ;=))
A common addition to the command line, at least for me, is to set the time of day to noon. This is because it is usually dark in San Francisco during my day. Another common option is the UFO ... so the above @set TEMP2 becomes -
@set TEMP2=--fg-root=data --timeofday=noon --aircraft=ufo --fdm=ufo --enable-hud
Some IMPORTANT key-ins I tend to remember, in no particular order, are -
More can be read in the data\Docs\FGShortRef.html that is downloaded with the standard data.
You can download my
release binary via HTTP ... this zip also includes
the three(3) sound shared (DLL) libraries needed to run this executable ... as
always, be wary of downloading and running executable files from the web ;=((
MD5 (fgfs-030-01.zip) = 583bf1038f713dc111f493460520099d
If you do want to build it yourself, then this
ZIP contains my MSVC8 solution and
project files. Of course, these will only function without modification if you choose to use exactly
the same folder structure as me ...
MD5 (fgfs-030-02.zip) = 1aae546563609c12947f1a9b469af85e
Of course, the drive, and base FG0910-4 do NOT have to be the same, and, as mentioned above, some of the sub-folders have been removed, compared to what is done using a cvs check-out ...
EOF - fgfs-b001.htm - Commenced Sunday, 23 July 2006 - Ended 27 July 2006.