Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-22 Thread David Megginson

Jonathan Polley writes:

  The only thing I see it complain about is using std::sort.  If I try 
  'using std::sort,' as is done if PROPS_STANDALONE is defined, I get the 
  same errors.  Considering the problems I am having getting JSBSim to 
  compile, with similar complaints, I am getting concerned that something 
  has gone terribly wrong.  If I had a better understanding of C++ and/or 
  STL, I could be more help hunting this down.  I may have to attempt a 
  re-install of MSVC tomorrow.

I'm pretty sure that this is another MSVC conformance bug.  There is a
C function sort in stdlib, and there is a C++ function sort with a
different signature in std.  I always try to avoid 'using namespace
std' in C++, just as I avoid things like import java.io.* in Java --
they're both bad design.  In this case, however, it seems to be a
necessary evil, so I'll make the change in SimGear.


All the best,


David

-- 
David Megginson
[EMAIL PROTECTED]


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-22 Thread David Megginson

Bernie Bright writes:

  Moving using std::sort after #include algorithm fixes the problem in
  props.cxx.

I thought I'd done that already, but the change must have been blown
away by something else.  Oh well.  I've checked it in now.


All the best,


David

-- 
David Megginson
[EMAIL PROTECTED]


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Erik Hofman

Jonathan Polley wrote:
 
 On Wednesday, March 20, 2002, at 06:00 PM, Christian Mayer wrote:
 
 Jonathan Polley wrote:


 MSVC 6.0 still whines about

 props.cxx
 C:\SimGear\simgear\misc\props.cxx(23) : error C2039: 'sort' : is not 
 a member of 'std'
 C:\SimGear\simgear\misc\props.cxx(23) : error C2873: 'sort' : symbol 
 cannot be used in a using-declaration
 C:\SimGear\simgear\misc\props.cxx(801) : error C2065: 'sort' : 
 undeclared identifier


 Dunno, but have you tried to add a

 SG_USING_NAMESPACE(std);

 above the SG_USING_STD(sort); ?

 
 If I replaced SG_USING_SD(sort) with SG_USING_NAMESPACE(std) it compiled 
 just fine.  I then found errors with FlightGear proper (but that is 
 another email).

Well, that's not the solution.
Irix has the same kind of problems, and the best way is something like:

#if !defined(MSVC)
SG_USING_SD(sort)
#endif

Erik




___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Jonathan Polley


On Thursday, March 21, 2002, at 06:43 AM, David Megginson wrote:

 Jonathan Polley writes:

 MSVC 6.0 still whines about

 props.cxx
 C:\SimGear\simgear\misc\props.cxx(23) : error C2039: 'sort' : is not a
 member of 'std'
 C:\SimGear\simgear\misc\props.cxx(23) : error C2873: 'sort' : symbol
 cannot be used in a using-declaration
 C:\SimGear\simgear\misc\props.cxx(801) : error C2065: 'sort' : undeclared
 identifier

 OK, first let's make sure that my code is correct ANSI C++ before we
 beat up on MSVC.  Basically, I have this:

   #include algorithm
   SG_USING_STD(sort);

 which is equivalent to

   #include algorithm
   using std::sort;

 Is this correct?  I think it is, but confirmation would be nice.

 If this is correct, then the next step is to add #ifdef's for MSVC
 (yech).

I tried 'using std::sort' in place of 'SG_USING_STD(sort)' and got the 
same errors.

Jonathan Polley


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Jonathan Polley

The only way I can get SimGear to build is to replace

SG_USING_STD(sort);

with

SG_USING_NAMESPACE(std);

Nothing else seems to work.  I have tried cleaning and rebuilding from 
scratch *multiple* times.

Jonathan Polley

On Thursday, March 21, 2002, at 06:43 AM, David Megginson wrote:

 Jonathan Polley writes:

 MSVC 6.0 still whines about

 props.cxx
 C:\SimGear\simgear\misc\props.cxx(23) : error C2039: 'sort' : is not a
 member of 'std'
 C:\SimGear\simgear\misc\props.cxx(23) : error C2873: 'sort' : symbol
 cannot be used in a using-declaration
 C:\SimGear\simgear\misc\props.cxx(801) : error C2065: 'sort' : undeclared
 identifier

 OK, first let's make sure that my code is correct ANSI C++ before we
 beat up on MSVC.  Basically, I have this:

   #include algorithm
   SG_USING_STD(sort);

 which is equivalent to

   #include algorithm
   using std::sort;

 Is this correct?  I think it is, but confirmation would be nice.

 If this is correct, then the next step is to add #ifdef's for MSVC
 (yech).


 All the best,


 David

 --
 David Megginson
 [EMAIL PROTECTED]


 ___
 Flightgear-devel mailing list
 [EMAIL PROTECTED]
 http://mail.flightgear.org/mailman/listinfo/flightgear-devel


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



RE: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Jon Berndt

 The only way I can get SimGear to build is to replace
 
 SG_USING_STD(sort);
 
 with
 
 SG_USING_NAMESPACE(std);
 
 Nothing else seems to work.  I have tried cleaning and rebuilding from 
 scratch *multiple* times.

Are there any other stdlib function calls in there from std namespace?

Jon


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Jonathan Polley


On Thursday, March 21, 2002, at 06:54 PM, Jon Berndt wrote:

 The only way I can get SimGear to build is to replace

 SG_USING_STD(sort);

 with

 SG_USING_NAMESPACE(std);

 Nothing else seems to work.  I have tried cleaning and rebuilding from
 scratch *multiple* times.

 Are there any other stdlib function calls in there from std namespace?

 Jon

The only thing I see it complain about is using std::sort.  If I try 
'using std::sort,' as is done if PROPS_STANDALONE is defined, I get the 
same errors.  Considering the problems I am having getting JSBSim to 
compile, with similar complaints, I am getting concerned that something 
has gone terribly wrong.  If I had a better understanding of C++ and/or 
STL, I could be more help hunting this down.  I may have to attempt a 
re-install of MSVC tomorrow.

Thanks,

Jonathan Polley


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Jonathan Polley


On Thursday, March 21, 2002, at 08:54 PM, Bernie Bright wrote:

 David Megginson wrote:

 OK, first let's make sure that my code is correct ANSI C++ before we
 beat up on MSVC.  Basically, I have this:

   #include algorithm
   SG_USING_STD(sort);

 which is equivalent to

   #include algorithm
   using std::sort;

 Is this correct?  I think it is, but confirmation would be nice.


 This is indeed Std C++ and is correct.

 The following compiles fine with MSVC6sp3:

 #include algorithm
 #include vector
 int main() {
   std::vectorint v;
   std::sort( v.begin(), v.end() );
   return 0;
 }

 Replacing std::sort() with sort() and adding using std::sort; also
 works.

 Cheers,
 Bernie

With the irregularity that I am having problems with using XXX I get the 
feeling that there is something wrong with a header someplace, or a 
#define.  Not all modules generate the error, and others (namely the 
updates, and only the updates, to JSBSim) blow body parts across the room.
   I can change the behavior of JSBSim by rearranging the #includes in some 
of the modules, but I cannot get rid of the errors.

Is anyone else building under MSVC 6.0 (or other MSVC compiler)?

Thanks,

Jonathan Polley


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Bernie Bright

Jonathan Polley wrote:
 

 With the irregularity that I am having problems with using XXX I get the
 feeling that there is something wrong with a header someplace, or a
 #define.  Not all modules generate the error, and others (namely the
 updates, and only the updates, to JSBSim) blow body parts across the room.
I can change the behavior of JSBSim by rearranging the #includes in some
 of the modules, but I cannot get rid of the errors.
 
 Is anyone else building under MSVC 6.0 (or other MSVC compiler)?
 

Moving using std::sort after #include algorithm fixes the problem in
props.cxx.

I build under MSVC6 occasionally though generally I use linux.  However
I was responsible for resolving some of the early portability issues.

Cheers,
Bernie

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-21 Thread Jonathan Polley


On Thursday, March 21, 2002, at 11:35 PM, Bernie Bright wrote:


 I build under MSVC6 occasionally though generally I use linux.  However
 I was responsible for resolving some of the early portability issues.

 Cheers,
 Bernie


Could you try a build of the main FlightGear app to verify if my FDM build 
problems are just me?

Thanks,

Jonathan Polley


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Christian Mayer

Jonathan Polley wrote:
 
 I just updated to the newest SimGear and tried to build under Windows using MSVC 
6.0. When I did so, I got the following errors:

I haven't tried it since the last major checkins :(

 Linux was just fine. Is there a problem with MS' implementation of STD?

That's more likely to be a problem with the Linux STL, as the M$ one is
very standard compliant and strict.

So there used to be a lot of STL problems where Linux coders wrote non
standard compliant STL code that brok on MSVC. (They are not really to
blame as they have no chance to test their code on MSVC; and they are
definitely not doing it on puropse)

CU,
Christian

--
The idea is to die young as late as possible.-- Ashley Montague

Whoever that is/was; (c) by Douglas Adams would have been better...

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Jon S Berndt

On Wed, 20 Mar 2002 22:55:23 +0100
  Christian Mayer [EMAIL PROTECTED] wrote:

So there used to be a lot of STL problems where Linux coders wrote non
standard compliant STL code that brok on MSVC. (They are not really to
blame as they have no chance to test their code on MSVC; and they are
definitely not doing it on puropse)

I remember there was also perfectly good code that broke 
under MSVC. Is this one fixed:

{
   for (int i=0;i5;i++) {
// do something
   }

   for (int i=7;i13;i++) {
// do something else
   }
}

The second for loop was causing problems with MSVC because 
it choked on the for-block-scoped int i declaration.

While I'm here: does the current JSBSim compile without 
problems under MSVC?

Jon

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



RE: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Norman Vine

Jon S Berndt writes:

I remember there was also perfectly good code that broke 
under MSVC. Is this one fixed:

{
   for (int i=0;i5;i++) {
// do something
   }

   for (int i=7;i13;i++) {
// do something else
   }
}

The second for loop was causing problems with MSVC because 
it choked on the for-block-scoped int i declaration.


AFAIK only in the new 'net' compiler

Note however that AFAIK the following variation
does work in MSVC

{
  {
   for (int i=0;i5;i++) {
// do something
   }
  } {
   for (int i=7;i13;i++) {
// do something else
   }
 }
}

Norman

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



RE: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Vallevand, Mark K

Not fixed in VC6.  Fixed in VC7.

However, the STDLIB and STL implementations in VC6 and VC7 are very good.
But, they weren't written by Microsoft.  They were written by P.J. Plauger's
company.

Regards.
Mark K Vallevand
Fat, dumb and happy.  2 out of 3 ain't bad.

 I remember there was also perfectly good code that broke 
 under MSVC. Is this one fixed:
 
 {
for (int i=0;i5;i++) {
 // do something
}
 
for (int i=7;i13;i++) {
 // do something else
}
 }
 
 The second for loop was causing problems with MSVC because 
 it choked on the for-block-scoped int i declaration.
 

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Christian Mayer

Norman Vine wrote:
 
 
 The second for loop was causing problems with MSVC because
 it choked on the for-block-scoped int i declaration.
 
 
 AFAIK only in the new 'net' compiler

In the new .NET compiler (i.e. version 7) it's fixed, the old one (MSVC
6) has that problem.

 Note however that AFAIK the following variation
 does work in MSVC
 
 {
   {
for (int i=0;i5;i++) {
 // do something
}
   } {
for (int i=7;i13;i++) {
 // do something else
}
  }
 }


Yes, it does. But it's sort of ugly. But not as ugly as a #define I've
seen once that fixes that problem, too.

CU,
Christian

--
The idea is to die young as late as possible.-- Ashley Montague

Whoever that is/was; (c) by Douglas Adams would have been better...

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Jonathan Polley
MSVC 6.0 still whines about

props.cxx
C:\SimGear\simgear\misc\props.cxx(23) : error C2039: 'sort' : is not a member of 'std'
C:\SimGear\simgear\misc\props.cxx(23) : error C2873: 'sort' : symbol cannot be used in a using-declaration
C:\SimGear\simgear\misc\props.cxx(801) : error C2065: 'sort' : undeclared identifier

,,,

#include simgear/compiler.h>
#include simgear/debug/logstream.hxx>

SG_USING_STD(sort);  -- This is line 24

...

vectorSGPropertyNode *>
SGPropertyNode::getChildren (const char * name)
{
vectorSGPropertyNode *> children;
int max = _children.size();

for (int i = 0; i  max; i++)
if (compare_strings(_children[i]->getName(), name))
children.push_back(_children[i]);

sort(children.begin(), children.end(), CompareIndices());  -- Line 801
return children;
}

...

Jonathan Polley


On Wednesday, March 20, 2002, at 07:44 AM, David Megginson wrote:

Jonathan Polley writes:

I just updated to the newest SimGear and tried to build under Windows 
using MSVC 6.0.  When I did so, I got the following errors:

I've moved the include for algorithm> higher in the file -- try
checking it out again and see if it builds now.


All the best,


David

-- 
David Megginson
[EMAIL PROTECTED]


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel


Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Christian Mayer

Jonathan Polley wrote:
 
 MSVC 6.0 still whines about
 
 props.cxx
 C:\SimGear\simgear\misc\props.cxx(23) : error C2039: 'sort' : is not a member of 
'std'
 C:\SimGear\simgear\misc\props.cxx(23) : error C2873: 'sort' : symbol cannot be used 
in a using-declaration
 C:\SimGear\simgear\misc\props.cxx(801) : error C2065: 'sort' : undeclared identifier
 

Dunno, but have you tried to add a

SG_USING_NAMESPACE(std);

above the SG_USING_STD(sort); ?

CU,
Christian

 ,,,
 
 #include simgear/compiler.h
 #include simgear/debug/logstream.hxx
 
 SG_USING_STD(sort); -- This is line 24
 
 ...
 
 vectorSGPropertyNode *
 SGPropertyNode::getChildren (const char * name)
 {
 vectorSGPropertyNode * children;
 int max = _children.size();
 
 for (int i = 0; i  max; i++)
 if (compare_strings(_children[i]-getName(), name))
 children.push_back(_children[i]);
 
 sort(children.begin(), children.end(), CompareIndices()); -- Line 801
 return children;
 }
 
 ...
 
 Jonathan Polley
 
 On Wednesday, March 20, 2002, at 07:44 AM, David Megginson wrote:
 
  Jonathan Polley writes:
 
   I just updated to the newest SimGear and tried to build under Windows
   using MSVC 6.0. When I did so, I got the following errors:
 
  I've moved the include for algorithm higher in the file -- try
  checking it out again and see if it builds now.
 
  All the best,
 
  David
 
  --
  David Megginson
  [EMAIL PROTECTED]
 
  ___
  Flightgear-devel mailing list
  [EMAIL PROTECTED]
  http://mail.flightgear.org/mailman/listinfo/flightgear-devel

--
The idea is to die young as late as possible.-- Ashley Montague

Whoever that is/was; (c) by Douglas Adams would have been better...

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] New SimGear does not Build Under MSVC 6.0

2002-03-20 Thread Jonathan Polley


On Wednesday, March 20, 2002, at 06:00 PM, Christian Mayer wrote:

 Jonathan Polley wrote:

 MSVC 6.0 still whines about

 props.cxx
 C:\SimGear\simgear\misc\props.cxx(23) : error C2039: 'sort' : is not a 
 member of 'std'
 C:\SimGear\simgear\misc\props.cxx(23) : error C2873: 'sort' : symbol 
 cannot be used in a using-declaration
 C:\SimGear\simgear\misc\props.cxx(801) : error C2065: 'sort' : 
 undeclared identifier


 Dunno, but have you tried to add a

 SG_USING_NAMESPACE(std);

 above the SG_USING_STD(sort); ?


If I replaced SG_USING_SD(sort) with SG_USING_NAMESPACE(std) it compiled 
just fine.  I then found errors with FlightGear proper (but that is 
another email).

 CU,
 Christian


Thanks,

Jonathan Polley


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel