Building FlightGear with MSVC6

index

Building FlightGear with MSVC6 - (Microsoft Visual C++ 6, circa 1998) - in April, 2006.

Some have suggested this is impossible, and after trying VERY HARD, I can only sadly agree with them! ;=(( This 'tool' was released about 1998, and up to Service Pack 6 was issued, but did not address address the problems covered here. I would certainly like to hear from anyone still able to compile and link SimGear/FlightGear 0.9.10, or later, with MSVC6!

I was ONLY able to eventually build the Release version of FlightGear, and NOT the Debug version, although I eventually got this also linked by stealing 2 object files from the Release ... 

IT DOES REQUIRE A CONSIDERABLE NUMBER OF CODE CHANGES! SOME OF WHICH I AM NOW SURE HAVE PERMANENTLY DAMAGED THE CODE! IN ESSENCE THIS WAS AN EXERCISE IN FUTILITY, BUT FUN, AS ALWAYS! I LOVE CODING!

The recommendation is that you use a LATER version of MSVC, namely MSVC7.1 (2003) or MSVC8 (2005), if at all possible, especially if it is your first build of FlightGear ... BUT IF YOU MUST, READ ON ;=))

PLIB zlib OpenAL SimGear FlightGear Running Difference


Directory Structure:

I use a root folder, in this case FG0910-1, and in that root, I have the following folders -

PLIB        - Build of latest CVS source of PLIB.
zlib-1.2.3  - unpack and build of the downloaded zlib tar.gz file.
OpenAL      - Build of latest CVS source of OpenAL.
SimGear     - Build of latest CVS source of SimGear.
source      - Build of latest CVS source of FlightGear.

Note, freeglut, and pthreads are two other optional folders, if desired, but are not fully covered here ... freeglut is an alternative to the GL that comes with the windows SDK, and pthreads is needed only if you add SGThread.cxx into the SimGear static library build, as it is in the VC8 project files, and you add ENABLE_THREADS when compiling FlightGear ... here I am using the Microsoft SDK GL (OpenGL), and not enabling threads ...


Building PLIB:

This is simple ... load the PLIB.DSW into MSVC6 ... check Project -> Settings ..., select first item 'fnt', and the C/C++ tab, selecting the Category: 'Code Generation' ... check that each project, fnt, js, net, psl, puAux, pui, pw, sg, sl, ssg, ssgAux and ul (note NOT the plib project - this is just a dependency item) is set the 'Multithreaded' ... that will be 'Debug Multithreaded' for the Debug configuration, and just 'Multithreaded' for the Release ...

Then 'Build' (F7), and watch them role by ... I only got ONE(1) warning -

C:\FG0910-1\PLIB\src\ssgAux\ssgaFire.cxx(129) : warning C4800: 'unsigned char' : forcing value to bool 'true' or 'false' (performance warning)

You will see this warning frequently in the coming hours ... eventually you learn to ignore it ;=))

I usually build BOTH the Debug and the Release ... select Build -> Set Active Configuration ... select either 'plib - Win32 Release' or 'plib - Win32 Debug' ... this is the reason for having the 'plib' project - it automatically selects all the others ... click [ OK ], then 'Build' (F7) ...

During the process you will note the output '1 file(s) copied' here and there ... This is copying the static libraries, and required headers to the PLIB root ... this makes it easier later to establish a path to these libraries and headers. PLIB separates the Debug static libraries from the others by adding '_d' into the name, like fnt.lib and fnt_d.lib as the release and the debug versions ...

When completed, the PLIB folder, will now contain some 24 static libraries, 12 Debug, and 12 Release, and a whole bunch of header files (about 36 at last count) ... these will be needed later ...

top PLIB zlib OpenAL SimGear FlightGear Running Difference


Building zlib:

This source came from a downloaded zlib-1.2.3.tar.gz file, which I unpacked, into the root FG0910-1, using the folder names ... If, by the time you are reading this, the version has moved on, no problem, just use that latest version, substituting your zlib-?.?.? for my zlib-1.2.3 where appropriate.

On loading the projects\visualc6 into MSVC6, you will note there are three (3) projects, and on opening Build -> Set Active Configuration, there are some 24 configurations, 12 Debug, and 12 Release ... unless you want to mess with the example files, or the minigzip application, you should only build 'zlib - Win32 LIB Release' and 'zlib - Win32 LIB Debug' ... NOTE, these are NOT usually the DEFAULT, so this selection is important ...

Again remember to check and change Project -> Settings ... selecting 'zlib', C/C++ tab, 'Code Generation' ... the default for 'Win32 LIB Release' is 'Multithreaded DLL', and for 'Win32 LIB Debug' is 'Debug Multithreaded DLL' ... these MUST be changed to just 'Multithreaded' and 'Debug Multithreaded' respectively ... that is without the 'DLL' ... this is IMPORTANT ...

The compile and link should just take seconds for the Debug and the Release ... when complete you should have two(2) static libraries, zlibd.lib and zlib.lib, in their respective folders as follows -

Directory of C:\FG0910-1\zlib-1.2.3\projects\visualc6\Win32_LIB_Debug
10/04/2006  01:55 PM           206,544 zlibd.lib
Directory of C:\FG0910-1\zlib-1.2.3\projects\visualc6\Win32_LIB_Release
10/04/2006  01:54 PM           100,730 zlib.lib

top PLIB zlib OpenAL SimGear FlightGear Running Difference


Building OpenAL:

The project contains 4 DSW files, OpenAL.dsw, alut.dsw, altest.dsw and win.dsw. Again, unless you want to run the tests, or other demo programs, then only the first two need be built ... they both build DLLs, alut.dsw is alut.dll, and OpenAL.dsw builds wrap_aol.dll, and openal32.dll, plus other pieces, each with their associated link libraries ...

Building OpenAL.dsw:

As usual, BE SURE to check Project -> Settings, selecting the desired project, C/C++ tab, Code Generation, for the run-time library. This is NOT so important in a DLL context, but you should get used to ALWAYS selecting 'Multithreaded' ... This does NOT even mean you may use multithreading in any project - it just establishes the Microsoft runtime library to use ... I have found the default in this project is usually 'Single-Threaded' ...

This contains 5 projects in the workspace ... that means there are 10 configurations, 5 Debug and 5 Release ... you only need to build OpenAL32 - Win32 Debug and Release, and the Router - Win32 Release and Debug, since there is and internal dependency which take care of the others ... I have found the default active project configuration is 'ALc - Win32 Debug' so this needs to be changed in Build -> Set Active Configuration ...'. Or you can use the Build -> Batch Build ... here I select them all except the 2 altest projects ...

Although, as mentioned, you only need to select OpenAL32 and the Router to build, as there is an internal dependency on the other projects, be sure you change ALL projects to the SAME Multithreaded, otherwise you will get the commonly seen linker warning, like -

Linking...
   Creating library Release/wrap_oal.lib and object Release/wrap_oal.exp
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
wrap_oal.dll - 0 error(s), 1 warning(s)

I have many times tried the suggested /NODEFAULT:LIBC, but this seldom works. It is better to change ALL projects to the SAME runtime ... Multithreaded ...

I got an ERROR when compiling the Router -

alc.cpp
C:\FG0910-1\openal\win\Router\alc.cpp(232) : error C2664: 'GetFileVersionInfoSizeA' : cannot convert parameter 1 from 'const char *' to 'char *'
        Conversion loses qualifiers

This was EASILY fixed by removing the 'const' qualifier. Namely -

ALboolean notOldNVIDIALib(const ALCchar* fileName)

was changed to -

ALboolean notOldNVIDIALib(ALCchar* fileName)

Why the developer put this 'const' qualifier in the first place is beyond me ...

When completed, there should be 4 DLL (2 Debug, 2 Release) -

Directory of C:\FG0910-1\openal\win\OpenAL32\Debug
10/04/2006  02:52 PM           409,667 wrap_oal.dll
Directory of C:\FG0910-1\openal\win\OpenAL32\Release
10/04/2006  02:52 PM           135,168 wrap_oal.dll
Directory of C:\FG0910-1\openal\win\Router\Debug
10/04/2006  02:52 PM           311,361 OpenAL32.dll
Directory of C:\FG0910-1\openal\win\Router\Release
10/04/2006  02:52 PM            86,016 OpenAL32.dll

and 8 libraries -

Directory of C:\FG0910-1\openal\win\Alc\Debug
10/04/2006  02:52 PM           104,278 ALc.lib
Directory of C:\FG0910-1\openal\win\Alc\Release
10/04/2006  02:52 PM            46,992 ALc.lib
Directory of C:\FG0910-1\openal\win\Alu\Debug
10/04/2006  02:52 PM            30,548 ALu.lib
Directory of C:\FG0910-1\openal\win\Alu\Release
10/04/2006  02:52 PM            10,014 ALu.lib
Directory of C:\FG0910-1\openal\win\OpenAL32\Debug
10/04/2006  02:52 PM            20,552 wrap_oal.lib
Directory of C:\FG0910-1\openal\win\OpenAL32\Release
10/04/2006  02:52 PM            20,552 wrap_oal.lib
Directory of C:\FG0910-1\openal\win\Router\Debug
10/04/2006  02:52 PM            20,228 OpenAL32.lib
Directory of C:\FG0910-1\openal\win\Router\Release
10/04/2006  02:52 PM            20,228 OpenAL32.lib

 

top PLIB zlib OpenAL SimGear FlightGear Running Difference

Building alut.dsw:

This contains 3 projects, but unless you want to 'try' the others, only the alut project is required ... also check the Project -> Settings, C/C++ tab, Code Generation, Runtime ... again the 'default' is usually 'Multithreaded DLL' ... this must be reduced to just 'Multithreaded' ... as usual I change all projects, even though I only need alut ...

Trying to compile I got an ERROR -

Compiling...
alutBufferData.c
..\..\..\include\AL/alut.h(4) : fatal error C1083: Cannot open include file: 'AL/al.h': No such file or directory

 

Opening the Project -> Settings ... and selecting 'alut', C/C++ tab, Category: Preprocessor I note it has the following in the 'Additional include directories:' -

..\..\..\include,C:\OpenALSDK\Include

Since I have NOT downloaded the OpenALSDK this second item, after the comma, is definitely wrong ;=))
Since the DSW/DSP files are in -

Directory of C:\FG0910-1\openal\alut\admin\VisualStudio6
27/11/2005  01:49 PM             1,143 alut.dsw

and the desired al.h is in -

Directory of C:\FG0910-1\openal\include\AL
31/01/2006  12:49 PM            27,481 al.h

 

I change this to -

..\..\..\include,..\..\..\..\include

 

But it need also to find the Router library -

Linking...
LINK : fatal error LNK1104: cannot open file "openal32.lib"
Error executing link.exe.

The Project -> Settings ..., Link tab, Category: Input shows again the SDK as 'Additional library path:', like -

C:\OpenALSDK\libs

I change this to the following for Debug configuration -

..\..\..\..\win\Router\Debug

and for the Release configuration -

..\..\..\..\win\Router\Release

At the end I am rewarded by two more DLLs

Directory of C:\FG0910-1\openal\alut\admin\VisualStudio6\alut\Debug
10/04/2006  03:26 PM           286,800 alut.dll
Directory of C:\FG0910-1\openal\alut\admin\VisualStudio6\alut\Release
10/04/2006  03:28 PM            94,208 alut.dll

and 2 more libraries -

Directory of C:\FG0910-1\openal\alut\admin\VisualStudio6\alut\Debug
10/04/2006  03:26 PM             5,660 alut.lib
Directory of C:\FG0910-1\openal\alut\admin\VisualStudio6\alut\Release
10/04/2006  03:28 PM             5,660 alut.lib

I will deal more with the INSTALLING of these DLLs later, but as you may know, there are two main choices - either copy them to the 'system' folder, usually c:\WINDOWS\System32, or directly to where the EXE file is being run from ...

top PLIB zlib OpenAL SimGear FlightGear Running Difference


Building SimGear:

Now with PLIB, and OpenAL compiled, I am ready to 'attack' SimGear ... so I load the SimGear.DSW file ... checking the Project -> Settings ... C/C++ tab, Code Generation Category, I can see both Debug and Release are set 'Multithreaded' ... but selecting the Preprocessor category, I note the following under 'Additional include directories' -

.,..,.\SimGear,..\zlib-1.2.3,..\OpenAL 1.0 Software Development Kit\include

Since the SimGear.DSW is in -

Directory of C:\FG0910-1\simgear\source

it will take two '..' to get out of simgear, and to my zlib-1.2.3 folder, OpenAL is again an SDK reference, and likewise, to get out to PLIB ... so I alter this to -

.,..\..,.\SimGear,..\..\zlib-1.2.3,..\..\OpenAL\include,..\..\OpenAL\alut\include

 

The first error of -

Compiling...
newbucket.cxx
c:\fg0910-1\simgear\source\simgear\bucket\newbucket.cxx(27) : fatal error C1083: Cannot open include file: 'simgear_config.h': No such file or directory
Error executing cl.exe.

reminds me that I should either copy simgear_config.h.vc5 to simgear_config.h, or FIX the custom copy step I know to be in the SimGear.DSP file ... I have long wanted to 'complain', explain, that this custom step DOES NOT WORK ...

Eventually I find a way to cause it to happen automatically, but it was quite complicated. Perhaps the simplest is to REMEMBER this MANUAL step ... there is a SIMILAR one in FlightGear, when I get there ...

As many developers will state, the MSVC6 compiler is quite a 'broken' beast ... rather than fixing known 'features' of this compiler, Microsoft concentrated on getting out the next version, MSVC7, and left this old compiler as-it-was ... THIS MEANS THERE WILL HAVE TO BE CODE CHANGES TO GET SIMGEAR TO COMPILE ... and the number is not necessarily small ;=((

The first -

lowlevel.cxx
c:\fg0910-1\simgear\source\simgear\misc\stdint.hxx(70) : error C2059: syntax error : 'bad suffix on number'
c:\fg0910-1\simgear\source\simgear\misc\stdint.hxx(70) : error C2146: syntax error : missing ')' before identifier 'L'
c:\fg0910-1\simgear\source\simgear\misc\stdint.hxx(70) : error C2059: syntax error : ')'
c:\fg0910-1\simgear\source\simgear\misc\stdint.hxx(70) : error C2059: syntax error : 'bad suffix on number'

indicates a use of a suffix that was only supported later, in MSVC7 ... But there is a suffix that does work ...

Here is my amended code, a pure MSVC6 version problem -

#if (_MSC_VER < 1300) // a MSVC6 version problem
    x = ((x >>  8) & 0x00FF00FF00FF00FFI64) | ((x <<  8) & 0xFF00FF00FF00FF00I64);
    x = ((x >> 16) & 0x0000FFFF0000FFFFI64) | ((x << 16) & 0xFFFF0000FFFF0000I64);
#else // later MSVC version
    x = ((x >>  8) & 0x00FF00FF00FF00FFLL) | ((x <<  8) & 0xFF00FF00FF00FF00LL);
    x = ((x >> 16) & 0x0000FFFF0000FFFFLL) | ((x << 16) & 0xFFFF0000FFFF0000LL);
#endif // a MSVC6 version problem

The next is similar -

fastmath.cxx
c:\fg0910-1\simgear\source\simgear\math\fastmath.cxx(50) : error C2065: 'M_LN2' : undeclared identifier

 

Later sets of 'system' header files included this value ...

Here it is in MSVC7 -

Microsoft Visual Studio .NET 2003\Vc7\include\math.h

#define M_LN2      0.693147180559945309417

Here it is in MSVC8

Microsoft Visual Studio 8\VC\include\math.h

#define M_LN2      0.693147180559945309417

But it DOES NOT EXIST IN MSVC6 -

Directory of C:\Program Files\Microsoft Visual Studio\VC98\Include
14/06/1998  04:00 PM            21,570 MATH.H

 

So I drop

#ifndef M_LN2 // a MSVC6 version problem
#define M_LN2 0.693147180559945309417
#endif // #ifndef M_LN2 // a MSVC6 version problem

into fastmath.hxx ...

Be prepared for some BIG UGLY WARNING, like -

metar.cxx
c:\program files\microsoft visual studio\vc98\include\utility(17) : warning C4786: '?$pair@Viterator@?$_Tree@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VSGM etarRunway@@@2@U_Kfn@?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@VSGMetarRunway@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@2@U?$less@V?$basic_string@DU?$char_tra its@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@std@@_N' : identifier was truncated to '255' characters in the browser information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class SGMetarRunway>,struct std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SGMetarRunway,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMetarRunway> >::_Kfn,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMetarRunway> >::iterator,bool>' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class SGMetarRunway &__thiscall std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SGMetarRunway,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMetarRunway> >::operator [](const class std::basic_string<char,struct std::char_traits<char>, class std::allocator<char> > &)'
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: '??0?$pair@Viterator@?$_Tree@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V SGMetarRunway@@@2@U_Kfn@?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@VSGMetarRunway@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@2@U?$less@V?$basic_string@DU?$char_ traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@std@@_N@std@@QAE@XZ' : identifier was truncated to '255' characters in the browser information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class SGMetarRunway>,struct std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SGMetarRunway,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMetarRunway> >::_Kfn,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMetarRunway> >::iterator,bool>' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class SGMetarRunway &__thiscall std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SGMetarRunway,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMetarRunway> >::operator [](const class std::basic_string<char,struct std::char_traits<char>, class std::allocator<char> > &)'
c:\program files\microsoft visual studio\vc98\include\utility(23) : warning C4786: '??0?$pair@Viterator@?$_Tree@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V SGMetarRunway@@@2@U_Kfn@?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@VSGMetarRunway@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@2@U?$less@V?$basic_string@DU?$char_ traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@std@@_N@std
@@QAE@ABViterator@?$_Tree@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@
std@@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@VSG MetarRunway@@@2@U_Kfn@?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D
@2@@std@@VSGMetarRunway@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator
@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@2@U?$less@V?$basic_string@DU?$char_tr aits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@VSGMetarRunway@@@2@@1@AB_N@Z' : identifier was truncated to '255' characters in the browser information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::pai

etc, etc, etc, ... nothing can really be done about these, until you get to an ERROR! As mentioned below you can add a pragma - #pragma warning( disable:4786; disable:4503) before any includes, and this warnings evaporate ... the length is due to the 'additions' by the compiler, to give the function a unique name ...

visual_enviro.cxx
c:\fg0910-1\simgear\source\simgear\structure\sgsharedptr.hxx(55) : error C2535: '__thiscall SGSharedPtr<U>::SGSharedPtr<U>(const class SGSharedPtr<U> &)' : member function already defined or declared
        c:\fg0910-1\simgear\source\simgear\structure\sgsharedptr.hxx(52) : see declaration of 'SGSharedPtr<T>::SGSharedPtr<T>'
        c:\fg0910-1\simgear\source\simgear\structure\sgsharedptr.hxx(97) : see reference to class template instantiation 'SGSharedPtr<T>' being compiled

I remove this by the UGLY -

#if (_MSC_VER > 1200) // a MSVC6 version problem
  template<typename U>
  SGSharedPtr(const SGSharedPtr<U>& p) : _ptr(p.ptr())
  { get(_ptr); }
#endif // #if (_MSC_VER > 1200) // a MSVC6 version problem

around what MSVC6 'thinks' are DUPLICATES ...

top PLIB zlib OpenAL SimGear FlightGear Running Difference

The next also happens frequently. MSVC6 seemed to NOT consider an if( int i = 0; ....) a separate context, so you get errors like -

props.cxx
c:\fg0910-1\simgear\source\simgear\props\props.cxx(755) : error C2374: 'i' : redefinition; multiple initialization
        c:\fg0910-1\simgear\source\simgear\props\props.cxx(753) : see declaration of 'i'

The current code is -

SGPropertyNode::~SGPropertyNode ()
{
  // zero out all parent pointers, else they might be dangling
  for (unsigned i = 0; i < _children.size(); ++i)
    _children[i]->_parent = 0;
  for (unsigned i = 0; i < _removedChildren.size(); ++i)
    _removedChildren[i]->_parent = 0;
  delete _path_cache;
  clearValue();
  delete _listeners;
}

I alter this code, to what is perhaps TIDIER anyway ;=() but agree this should NOT need to be done ... if only the compiler understood, and later version do ...

SGPropertyNode::~SGPropertyNode ()
{
  unsigned i;
  // zero out all parent pointers, else they might be dangling
  for ( i = 0; i < _children.size(); ++i)
    _children[i]->_parent = 0;
  for ( i = 0; i < _removedChildren.size(); ++i)
    _removedChildren[i]->_parent = 0;
  delete _path_cache;
  clearValue();
  delete _listeners;
}

The 'fix' in ssgSharedPtr.hxx is similar to SharedPtr.hxx -

  ssgSharedPtr(const ssgSharedPtr& p) : _ptr(p.ptr())
  { get(_ptr); }
#if (_MSC_VER > 1200) // a MSVC6 version problem
  template<typename U>
  ssgSharedPtr(const ssgSharedPtr<U>& p) : _ptr(p.ptr())
  { get(_ptr); }
#endif // #if (_MSC_VER > 1200) // a MSVC6 version problem
  ~ssgSharedPtr(void)
  { put(); }
 
  ssgSharedPtr& operator=(const ssgSharedPtr& p)
  { assign(p.ptr()); return *this; }
#if (_MSC_VER > 1200) // a MSVC6 version problem
  template<typename U>
  ssgSharedPtr& operator=(const ssgSharedPtr<U>& p)
  { assign(p.ptr()); return *this; }
#endif // #if (_MSC_VER > 1200) // a MSVC6 version problem
  template<typename U>
  ssgSharedPtr& operator=(U* p)
  { assign(p); return *this; }

 

Some the fixes shown here are NOT difinitive ... sometimes, as the compile and link progresses it is necessary to come back and 'adjust' some of these 'adjustments' ... they are NOT 'fixes', just mangling of the code to overcome the short comings of the compiler ...

The next is also repeated many times ... MSVC6 has a BIG PROBLEM with an 'iterator' declaration ... it is fixed just by separating the declaration into to parts ;=/

Compiling...
mat.cxx
c:\fg0910-1\simgear\source\simgear\scene\material\mat.hxx(180) : error C2653: 'map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SGMaterialGlyph *,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMaterialGlyph *> >' : is not a class or namespace name
c:\fg0910-1\simgear\source\simgear\scene\material\mat.hxx(180) : error C2065: 'const_iterator' : undeclared identifier
c:\fg0910-1\simgear\source\simgear\scene\material\mat.hxx(180) : error C2146: syntax error : missing ';' before identifier 'it'
c:\fg0910-1\simgear\source\simgear\scene\material\mat.hxx(180) : error C2065: 'it' : undeclared identifier
c:\fg0910-1\simgear\source\simgear\scene\material\mat.hxx(180) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::_Tree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class SGMaterialGlyph *>,struct std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class SGMaterialGlyph *,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMaterialGlyph *> >::_Kfn,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class SGMaterialGlyph *> >::const_iterator' (or there is no acceptable conversion)
c:\fg0910-1\simgear\source\simgear\scene\material\mat.hxx(181) : error C2227: left of '->second' must point to class/struct/union

The original code is -

  virtual SGMaterialGlyph * get_glyph (const string& name) const {
    map<string, SGMaterialGlyph *>::const_iterator it = glyphs.find(name);
    return it != glyphs.end() ? it->second : 0;
  }

This code becomes first a typedef, then using that definition in the iterator, like -

  typedef map<string, SGMaterialGlyph *> SGMG_MAP;
  virtual SGMaterialGlyph * get_glyph (const string& name) const {
    SGMG_MAP::const_iterator it = glyphs.find(name);
    return it != glyphs.end() ? it->second : 0;
  }

And later -

    map<string, ssgSharedPtr<ssgEntity> >::iterator it = _table.begin();

becomes -

    typedef map<string, ssgSharedPtr<ssgEntity> > SSGSP_MAP;
    SSGSP_MAP::iterator it = _table.begin();

there are several, many!, more changes like these ...

Then a problem over public versus private class members -

c:\fg0910-1\simgear\source\simgear\scene\model\shadowvolume.cxx(393) : error C2248: 'CameraViewM' : cannot access private member declared in class 'SGShadowVolume'
        c:\fg0910-1\simgear\source\simgear\scene\model\shadowvolume.hxx(139) : see declaration of 'CameraViewM'
c:\fg0910-1\simgear\source\simgear\scene\model\shadowvolume.cxx(404) : error C2248: 'frameNumber' : cannot access private member declared in class 'SGShadowVolume'
        c:\fg0910-1\simgear\source\simgear\scene\model\shadowvolume.hxx(137) : see declaration of 'frameNumber'
c:\fg0910-1\simgear\source\simgear\scene\model\shadowvolume.cxx(412) : error C2248: 'sunPos' : cannot access private member declared in class 'SGShadowVolume'
        c:\fg0910-1\simgear\source\simgear\scene\model\shadowvolume.hxx(136) : see declaration of 'sunPos'

Each of these are placed in the 'public' section -

      ssgSharedPtr<ssgBranch> ssg_root;
      bool shadows_rendered;
public:
      bool      shadows_enabled;
      bool      shadowsAC_enabled, shadowsAI_enabled, shadowsTO_enabled, shadowsDebug_enabled;
      bool      shadowsAC_transp_enabled;
      int lastTraverseTreeFrame;
      sgMat4 CameraViewM;
      sgVec3 sunPos;
      int frameNumber;
      bool      use_alpha;
};

but that fails to 'fix' all the problems with shadowvolume.cxx, so for now I exclude it from the build ... to come back to it later ...

Another where 'typedef' must be used ...

        typedef list<Leaf> LEAF_LIST;
        //list<Leaf>::iterator li = leaf_list.begin();
        LEAF_LIST::iterator li = leaf_list.begin();

The next was a new one on me ;=()

Compiling...
xmlsound.cxx
c:\fg0910-1\simgear\source\simgear\sound\xmlsound.cxx(211) : error C2552: 'pitch' : non-aggregates cannot be initialized with initializer list
Error executing cl.exe.

I 'fixed' this with -

#if (_MSC_VER < 1300) // a MSVC6 version problem
      _snd_prop pitch;
      pitch.prop = NULL;
      pitch.fn = NULL;
      pitch.intern = NULL;
      pitch.factor = 1.0;
      pitch.offset = 1.0;
      pitch.min = 0.0;
      pitch.max = 0.0;
      pitch.subtract = false;
#else // #ifdef (_MSC_VER < 1300) // a MSVC6 version problem
      _snd_prop pitch = {NULL, NULL, NULL, 1.0, 1.0, 0.0, 0.0, false};
#endif // #ifdef (_MSC_VER < 1300) // a MSVC6 version problem

Another 'stupid' iterator problem, solved with -

   typedef map<string,SGSubsystem *> sSGS_MAP;
   // map<string,SGSubsystem *>::iterator s =_subsystem_map.find(name);
   sSGS_MAP::iterator s =_subsystem_map.find(name);

This gets a 'library' compiled -
SimGear.lib - 0 error(s), 0 warning(s)
but with one item 'excluded' ... maybe it is NOT needed ...

Switching to the Release configuration, there is surprisingly few warnings -

SimGear.lib - 1 error(s), 9 warning(s)

The one error is shadowvolume.cxx, which I again exclude from the build ...

Can NOT seem to SOLVE this shadowvolume.cxx error -

Compiling...
shadowvolume.cxx
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : error C2676: binary '<' : 'const class ssgSharedPtr<class ssgBranch>' does not define this operator or a conversion to a type acceptable to the predefined operator
        C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\functional(86) : while compiling class-template member function 'bool __thiscall std::less<class ssgSharedPtr<class ssgBranch> >::operator ()(const class ssgSharedPtr<class ssgBranch> &,const class ssgSharedPtr<class ssgBranch> &) const'
Error executing cl.exe.
SimGear.lib - 1 error(s), 0 warning(s)

Each time this ERROR was being caused by a line of code like -

      SceneryObject_map::iterator iSceneryObject = sceneryObjects.find( occluder );

It seems the 'standard' find function INSISTS a '<' (less than) operator be defined ... but WHY ???

When completed I have two static libraries -

Directory of C:\FG0910-1\SimGear\source\Debug
10/04/2006  05:49 PM        14,720,268 SimGear.lib
Directory of C:\FG0910-1\SimGear\source\Release
10/04/2006  05:56 PM         4,475,658 SimGear.lib

top PLIB zlib OpenAL SimGear FlightGear Running Difference


Building FlightGear:

Loading the FlightGear.DSW project file, and starting the compile, I noted that the custom step to copy config.h-msvc6 to config.h did not work, so I had to do this step manually ...

The first error was concerning the use of a 'reserved' word - list ...

replay.cxx
c:\fg0910-1\source\src\aircraft\replay.cxx(405) : error C2955: 'list' : use of class template requires template argument list
        c:\program files\microsoft visual studio\vc98\include\list(415) : see declaration of 'list'

I am sure this would not happen except that FlightGear DOES use 'list' ... so I changed the function to -

static void interpolate( double time, const replay_list_type &my_list ) {
    // sanity checking
    if ( my_list.size() == 0 ) {
        // handle empty list
        return;
    } else if ( my_list.size() == 1 ) {
        // handle list size == 1
        update_fdm( my_list[0] );
        return;
    }
    unsigned int last = my_list.size() - 1;
    unsigned int first = 0;
    unsigned int mid = ( last + first ) / 2;
    bool done = false;
    while ( !done ) {
        // cout << "  " << first << " <=> " << last << endl;
        if ( last == first ) {
            done = true;
        } else if ( my_list[mid].sim_time < time && my_list[mid+1].sim_time < time ) {
            // too low
            first = mid;
            mid = ( last + first ) / 2;
        } else if ( my_list[mid].sim_time > time && my_list[mid+1].sim_time > time ) {
            // too high
            last = mid;
            mid = ( last + first ) / 2;
        } else {
            done = true;
        }
    }
    FGReplayData result = interpolate( time, my_list[mid], my_list[mid+1] );
    update_fdm( result );
}

that is, using 'my_list' in place of 'list' ...

The next is a COMMON and KNOWN fault of MSVC6 ... It can not parse the 'iterator' correctly, and make a quite misleading error message -

Compiling...
apt_loader.cxx
c:\fg0910-1\source\src\airports\runwayprefs.hxx(30) : error C2653: 'vector<long,class std::allocator<long> >' : is not a class or namespace name
c:\fg0910-1\source\src\airports\runwayprefs.hxx(30) : error C2146: syntax error : missing ';' before identifier 'timeVecConstIterator'
c:\fg0910-1\source\src\airports\runwayprefs.hxx(30) : fatal error C1004: unexpected end of file found

The present code already does a typedef -

typedef vector<time_t> timeVec;
typedef vector<time_t>::const_iterator timeVecConstIterator;

but does not use it ??? Changing the code to -

typedef vector<time_t> timeVec;
typedef timeVec::const_iterator timeVecConstIterator;
typedef vector<string> stringVec;
typedef stringVec::iterator stringVecIterator;
typedef stringVec::const_iterator stringVecConstIterator;

works fine ...

There are more - change -

typedef vector<RunwayList> RunwayListVec;
typedef vector<RunwayList>::iterator RunwayListVectorIterator;
typedef vector<RunwayList>::const_iterator RunwayListVecConstIterator;

to

typedef vector<RunwayList> RunwayListVec;
typedef RunwayListVec::iterator RunwayListVectorIterator;
typedef RunwayListVec::const_iterator RunwayListVecConstIterator;

I have to make a similar change in several other places ...

The next are some BIG WARNING -

The first is just an unreferenced local variable -

simple.cxx
c:\fg0910-1\source\src\airports\simple.cxx(116) : warning C4101: 'e' : unreferenced local variable
c:\fg0910-1\source\src\airports\simple.cxx(128) : warning C4101: 'e' : unreferenced local variable

The next is LOTS OF VERBIAGE, but all it is saying is that it has truncated the DEBUG string to 255 characters ... no problem at all ;=))

c:\program files\microsoft visual studio\vc98\include\utility(17) : warning C4786: '?$pair@Viterator@?$_Tree@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@
@std@@U?$pair@$$CBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@PAVF
GAirport@@@2@U_Kfn@?$map@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2
@@std@@PAVFGAirport@@U?$less@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@
D@2@@std@@@2@V?$allocator@PAVFGAirport@@@2@@2@U?$less@V?$basic_string
@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@V?$allocator@PAVFGAirport
@@@2@@std@@_N' : identifier was truncated to '255' characters in the browser information
        c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,struct std::pair<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const ,class FGAirport *>,struct std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class FGAirport *,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class FGAirport *> >::_Kfn,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >>,class std::allocator<class FGAirport *> >::iterator,bool>' being compiled
        c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class FGAirport *&__thiscall std::map<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class FGAirport *,struct std::less<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >,class std::allocator<class FGAirport *> >::operator [](const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &) '

top PLIB zlib OpenAL SimGear FlightGear Running Difference

The next is -

Compiling...
runwayprefs.cxx
c:\fg0910-1\source\src\airports\runwayprefs.cxx(251) : error C2065: 'M_PI' : undeclared identifier

This constant has subsequently been defined in MSVC7 and MSVC8, but it did NOT exist in MSVC6 ...

Here it is defined in MSVC7 includes -

Microsoft Visual Studio .NET 2003\Vc7\include\math.h

#define M_PI       3.14159265358979323846

And here it is in MSVC* includes -

Microsoft Visual Studio 8\VC\include\math.h

#define M_PI       3.14159265358979323846

I add this code, after all the #include lines, to runwayprefs.cxx

#ifndef M_PI

#define M_PI       3.14159265358979323846

#endif // M_PI

The next is another COMMON MSVC6 ERROR -

c:\fg0910-1\source\src\airports\runwayprefs.cxx(298) : error C2374: 'i' : redefinition; multiple initialization
        c:\fg0910-1\source\src\airports\runwayprefs.cxx(224) : see declaration of 'i'
c:\fg0910-1\source\src\airports\runwayprefs.cxx(307) : error C2374: 'i' : redefinition; multiple initialization
        c:\fg0910-1\source\src\airports\runwayprefs.cxx(224) : see declaration of 'i'

It is easily fixed by declaring int i; at the top of the function, and removing the for( int i; ..., making it just for( i = 0; ...

This same error can happen with any variable -

Compiling...
tower.cxx
c:\fg0910-1\source\src\atc\tower.cxx(621) : error C2086: 'twrItr' : redefinition

Developer are always using new ones, which make this type of 'fixing' interesting ... this I had not seen before -

fgclouds.cxx
c:\fg0910-1\source\src\environment\fgclouds.cxx(114) : error C2639: compiler generated default constructor required by unnamed class

This comes from the code -

void FGClouds::buildLayer(SGCloudField *layer, const string& name, double alt, double coverage) {
      struct {
            string name;
            double count;
      } tCloudVariety[20];

The work around I provide is -

typedef struct {
            string name;
            double count;
} CLOUDVAR;
void FGClouds::buildLayer(SGCloudField *layer, const string& name, double alt, double coverage) {
      CLOUDVAR tCloudVariety[20];

The 'iterator' comes up frequently -

Compiling...
fgclouds.cxx
c:\fg0910-1\source\src\environment\fgclouds.cxx(318) : error C2653: 'vector<class SGMetarCloud,class std::allocator<class SGMetarCloud> >' : is not a class or namespace name
c:\fg0910-1\source\src\environment\fgclouds.cxx(318) : error C2065: 'const_iterator' : undeclared identifier

The code is -

    vector<SGMetarCloud> cv = m->getClouds();
    vector<SGMetarCloud>::const_iterator cloud;

The work around is -

    typedef vector<SGMetarCloud> SGMC_VEC;
    SGMC_VEC cv = m->getClouds();
    SGMC_VEC::const_iterator cloud;

The next has been fixed if compiling JSBSim separately -

Compiling...
JSBSim.cxx
c:\fg0910-1\source\src\fdm\jsbsim\fgjsbbase.h(241) : error C2065: 'max' : undeclared identifier

It was a matter of COPYING the max, min section again ... And because of the MASSIVE output of the truncation warnings, I had to drop -

#pragma warning( disable:4786; disable:4503)

into the top of FGCondition.cpp ;=))

Another FIRST ... this MUST be my lucky day ;=))

uiuc_recorder.cpp
c:\program files\microsoft visual studio\vc98\include\ostream(350) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit

The MSVC6 help says -

"The /Zmnumber option determines the compiler's memory allocation limit. The number argument is a scaling factor, with a default value of 100 (that is, 100%). The maximum value is 2000."

Have to give up on this for the moment ... exclude from build ...

Many more of the SAME, and some SGquatd items excluded from build ... Then

Compiling...
Schedule.cxx

Ignoring the multiple 'truncation' warnings ...

c:\program files\microsoft visual studio\vc98\include\vector(48) : warning C4786:

to get to this error ...

c:\fg0910-1\source\src\traffic\schedule.cxx(218) : error C2667: 'sort' : none of 2 overload have a best conversion

Not sure why, but the code must be changed from -

  sort(flights.begin(), flights.end());

to

  std::sort(flights.begin(), flights.end());

At the same time usually drop in -

#pragma warning( disable:4786; disable:4503)

to kill the truncation stuff so I can SEE the error ...

This gets me to the LINK stage, but as expected, since I have excluded some modules from the build I get a number of unresolved items ... like -

Linking...
uiuc_wrapper.obj : error LNK2001: unresolved external symbol "void __cdecl uiuc_recorder(double)" (?uiuc_recorder@@YAXN@Z)
groundcache.obj : error LNK2001: unresolved external symbol "public: void __thiscall FGAICarrier::getVelocityWrtEarth(double (&)[3],double (&)[3],double (&)[3])" (?getVelocityWrtEarth@FGAICarrier@@QAEXAAY02N00@Z)

Also lots of TROUBLE with AIBase.cxx, and SGQuatd.hxx ... just could not seem to get these right ... one line I had to REMOVE with _MSC_VER switches was -

#if   !defined(_MSC_VER) || (_MSC_VER > 1200)
  hlTrans *= SGQuatd::fromYawPitchRollDeg(hdg, pitch, roll);
#endif // #if   !defined(_MSC_VER) || (_MSC_VER > 1200)

Just could not get this to compile ...

But at the same time, am working on an auto-generation of DSP/DSW build files ... so I make some fixes to them ... I want to separate source files from header files, and provide a WORKING custom step to create config.h ... but never could get this latter item working in Release configuration, and only sometimes in Debug ...

For the Release version the Object/library modules: seems wrong - it is presently -

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib uuid.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib SimGear.lib ssg.lib sg.lib pui.lib fnt.lib sl.lib ul.lib ssgaux.lib net.lib zlib.lib OpenAL32.lib alut.lib

First WHY the duplication, and 2nd where is wsock32.lib (or ws2_32.lib)? And missed PLIB, js.lib ... I reduce/fix this list to ...

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ws2_32.lib SimGear.lib ssg.lib sg.lib pui.lib fnt.lib sl.lib ul.lib ssgaux.lib net.lib js.lib zlib.lib OpenAL32.lib alut.lib

 

And. of course, similarly for the Debug configuration - it begins as -

kernel32.lib user32.lib winspool.lib comdlg32.lib gdi32.lib shell32.lib wsock32.lib SimGear.lib ssg_d.lib sg_d.lib pui_d.lib fnt_d.lib sl_d.lib ul_d.lib ssgaux_d.lib net_d.lib zlibd.lib OpenAL32.lib alut.lib

which only seems to require js_d.lib and advapi32.lib added, and wsock32.lib changed to ws2_32.lib -

kernel32.lib user32.lib winspool.lib comdlg32.lib gdi32.lib advapi32.lib shell32.lib ws2_32.lib SimGear.lib ssg_d.lib sg_d.lib pui_d.lib fnt_d.lib sl_d.lib ul_d.lib ssgaux_d.lib net_d.lib js_d.lib zlibd.lib OpenAL32.lib alut.lib

Also, I had to copy instrument_mgr.obj and mk_viii.obj from the Release folder ... since I have therefore MIXED Release and Debug libraries, I do get a link warning -

Linking...
LINK : warning LNK4098: defaultlib "LIBCMTD" conflicts with use of other libs; use /NODEFAULTLIB:library
FlightGear.exe - 0 error(s), 1 warning(s)

which I choose to ignore. With two links complete, I even get time to cut in my two favourite additions ... one to cockpit.cxx to always display the frame rate, and one to UFO.cxx, to start it off in slow mode, controlled by the G/g keys ...

cockpit.cxx

Near the top, added -

#define ADD_FPS_STRING

then in the -

void fgCockpitUpdate( void ) {

function, add the following -

    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 ) ) {
    if(1) {
        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 );

And to UFO.cxx add -

    // the velocity of the aircraft
    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;
        }
    }

All done ...

top PLIB zlib OpenAL SimGear FlightGear Running Difference


Running FlightGear:

The command line must contain a pointer to the scenery data folder, and in my case I want to run the UFO, so my command line is -

Release\FlightGear.exe --fg-root=c:\FGCVS\FlightGear\data --fdm=ufo --aircraft=ufo

and give it a try ... but I get no joy ... nothing happens ... so I try adding ...

Release\FlightGear.exe --fg-root=c:\FGCVS\FlightGear\data --fdm=ufo --aircraft=ufo --log-level=debug

But I end up aborting with Ctrl+C ... At least when I try the Debug version, I get a different response -

C:\FG0910-1\source>Debug\FlightGear.exe --fg-root=c:\FGCVS\FlightGear\data --fdm=ufo --aircraft=ufo --log-level=debug
Unknown exception in the main loop. Aborting...

Running the Debug version in the MSVC6 debugger, and the 'exception' occurs still in fgMainInit() in the code - upper_case_property("/sim/presets/airport-id"); ... tracing into this ... the Call Stack shows it is just REPEATING in -

SGPropertyNode::fireChildAdded(SGPropertyNode * 0x01a65468, SGPropertyNode * 0x01a65468) line 2108

until there is a Stack overflow, that generates an exception ... I figure this is something to do with the messing up I had to do in the code -

#if !defined(_MSC_VER) || (_MSC_VER > 1200) // a MSVC6 version problem
SGSharedPtr& operator=(const SGSharedPtr& p)
{ assign(p.ptr()); return *this; }
#endif // #if !defined(_MSC_VER) || (_MSC_VER > 1200)
template<typename U>
SGSharedPtr& operator=(const SGSharedPtr<U>& p)
{ assign(p.ptr()); return *this; }
template<typename U>
SGSharedPtr& operator=(U* p)
{ assign(p); return *this; }

Perhaps the 'removing' of one of the '=' operators has left the code in a BAD STATE? ... maybe I need to go back and try another fix in SimGear? ...

Anyway I decide I have spent enough TIME on this sorry tale. I reached the sad conclusion that FlightGear, and in this specific case, SimGear, can no longer be correctly compiled with MSVC6 ...

top PLIB zlib OpenAL SimGear FlightGear Running Difference


The Difference:

Using some GNU utilities for Win32 from http://unxutils.sourceforge.net/ I have prepared a 'diff' file of all the changes I made ... if you point to just the source files, then the command line for the 'diff' tool can be quite simple -

diff -ur "original CVS folder" "modified folder" > msvc6???.txt

If you want to do the whole folder, then the command line for the 'diff' tool can be very large, to exclude all the MSVC6 generated files -

diff -ur -x *.exe -x *.suo -x *.obj -x *.ncb -x *.dsw -x *.dsp -x *.pdb -x *.idb -x *.ilk -x *.pch -x *.lib -x *.dep -x *.mak -x *.opt -x *.plg -x Debug -x Release "original CVS source" "amended source" > msvc6???.txt

OpenAL:
command: diff -ur -x *.dll -x *.exe -x *.suo -x *.obj -x *.ncb -x *.pdb -x *.idb -x *.ilk -x *.pch -x *.lib -x *.dep -x *.mak -x *.opt -x *.plg -x Debug -x Release c:\FGCVS\AL\openal openal > msvc6aldiff.txt
This msvc6ALdiff.txt contains mainly changes to the DSP files ... apparently they were originally in German, and my English MSVC6 translated them back to english ... but down near the bottom of the file is the one small change of removing a 'const' in alc.c ...

zlib:
command: diff -ur -x *.dll -x *.exe -x *.suo -x *.obj -x *.ncb -x *.pdb -x *.idb -x *.ilk -x *.pch -x *.lib -x *.dep -x *.mak -x *.opt -x *.plg -x Debug -x Release c:\FGCVS\zlib-1.2.3 zlib-1.2.3 > msvc6zlibdiff.txt
This msvc6zlibdiff.txt contain only the VERY IMPORTANT change of the runtime library in zlib.dsp file ... a change from /MD[d] to /MT[d] ... from Multithreaded DLL to Multithreaded ...

PLIB:
command: diff -ur -x *.dll -x *.exe -x *.suo -x *.obj -x *.ncb -x *.pdb -x *.idb -x *.ilk -x *.pch -x *.lib -x *.dep -x *.mak -x *.opt -x *.plg -x Debug -x Release c:\FGCVS\PLIB PLIB > msvc6plibdiff.txt
This msvc6plibdiff.txt contains NO SOURCE changes. It only shows how the header files were copied from various internal folder, into the PLIB root folder ... this is a good way to expose set of library headers ...

SimGear:
command: diff -ur -x *.dll -x *.exe -x *.suo -x *.obj -x *.ncb -x *.pdb -x *.idb -x *.ilk -x *.pch -x *.lib -x *.dep -x *.mak -x *.opt -x *.plg -x Debug -x Release c:\FGCVS\SimGear SimGear > msvc6sgdiff.txt
This msvc6sgdiff.txt contains some VERY QUESTIONABLE code changes. I believe it is some of these changes that caused FlightGear to NOT RUN ... Also the bottom section is just mainly due to line ending changes in SimGear.dsp file, so the whole file has been replaced ...

FlightGear:
command: diff -ur -x *.dsw -x *.dsp -x *.cfg -x *.dll -x *.exe -x *.suo -x *.obj -x *.ncb -x *.pdb -x *.idb -x *.ilk -x *.pch -x *.lib -x *.dep -x *.mak -x *.opt -x *.plg -x Debug -x Release c:\FGCVS\FlightGear\source source > msvc6fgdiff.txt
This msvc6fgdiff.txt has some important, and also perhaps questionable code changes. Remember, these are not code 'fixes', but 'hacks' to provide a work around for the errant MSVC6. Also I have excluded the DSP/DSW files, since I tried a completely different style with these ...

This msvc6build.zip contains ALL the DSW/DSP files from this set of folders. Note some were not used.

To state again, to build FlightGear with MSVC6 IS VERY DIFFICULT, AND PERHAPS IMPOSSIBLE, but can only hope something on this page helps others who want to try ;=)) At present, you can obtain MSVC8 (Microsoft Visual C++ 2005 Express Edition) for free at this URL -

- http://msdn.microsoft.com/vstudio/express/visualc/

Maybe you will have better luck with this later tool. ;=))

top PLIB zlib OpenAL SimGear FlightGear Running Difference

EOF - fg-40-msvc6.doc

index