www.digitalmars.com         C & C++   DMDScript  

c++ - Compile error using -A and Stlport 4.5.3

reply "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Using the STLPort 4.5.3 configured to work with Digital Mars, when I compile
this program with the -A switch:

class C
{
private:
void f();
};

class D
{
friend void C::f();
};

I get:


 ^
C:\DigitalMars\stlport\stlport\stl/_config.h(370) : Preprocessor error
: '_STLP_DEFAULT_TYPE_PARAM' is already defined
--- errorlevel 1

but if I compile without the -A switch, there is no error. Of course there
should be an error in strict Ansi mode ( 11.4 para 7 says
"A name nominated by a friend declaration shall be accessible in the scope
of the class containing the friend declaration. " ), but I certainly
wouldn't expect a preprocessing error coming out of stlport. Notice that I
have included no files, which makes the error doubly curious. Is this a
fault of STLPort rather than Digital Mars ? I notice the latest STLPort is
4.6. Is there a version configured for Digital Mars using that latest
version which perhaps doesn't have this bug ?
Apr 10 2004
next sibling parent reply Scott Michel <scottm mordred.cs.ucla.edu> writes:
Edward Diener <eddielee_no_spam_here_and_now tropicsoft.com> wrote:
                                                               Is this a
 fault of STLPort rather than Digital Mars ? I notice the latest STLPort is
 4.6. Is there a version configured for Digital Mars using that latest
 version which perhaps doesn't have this bug ?
"-A" and STLport have issues coexisting.
Apr 10 2004
parent reply "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Scott Michel wrote:
 Edward Diener <eddielee_no_spam_here_and_now tropicsoft.com> wrote:
                                                               Is
 this a fault of STLPort rather than Digital Mars ? I notice the
 latest STLPort is
 4.6. Is there a version configured for Digital Mars using that latest
 version which perhaps doesn't have this bug ?
"-A" and STLport have issues coexisting.
That is pretty succinct. Are either parties, Digital Mars and STLPort, aware of that and attempting to make peace and live amicably together with their child -A ?
Apr 10 2004
parent reply Scott Michel <scottm mordred.cs.ucla.edu> writes:
Edward Diener <eddielee_no_spam_here_and_now tropicsoft.com> wrote:
 Scott Michel wrote:
 Edward Diener <eddielee_no_spam_here_and_now tropicsoft.com> wrote:
                                                               Is
 this a fault of STLPort rather than Digital Mars ? I notice the
 latest STLPort is
 4.6. Is there a version configured for Digital Mars using that latest
 version which perhaps doesn't have this bug ?
"-A" and STLport have issues coexisting.
That is pretty succinct. Are either parties, Digital Mars and STLPort, aware of that and attempting to make peace and live amicably together with their child -A ?
All standards are subject to interpretation and DMC++ is no exception (although I happen to like the interpretation.) STLport's objective is a high degree of portability between a lot of compiler platforms; it's full of a lot of compromises. So, no, it's not likely to reconcile -A between DMC and STLport. Of course, you're more than welcome to hack the STLport code, send patches back to stlport.com to reconcile the problems. :-) :-)
Apr 11 2004
parent "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Scott Michel wrote:
 Edward Diener <eddielee_no_spam_here_and_now tropicsoft.com> wrote:
 Scott Michel wrote:
 Edward Diener <eddielee_no_spam_here_and_now tropicsoft.com> wrote:
                                                               Is
 this a fault of STLPort rather than Digital Mars ? I notice the
 latest STLPort is
 4.6. Is there a version configured for Digital Mars using that
 latest version which perhaps doesn't have this bug ?
"-A" and STLport have issues coexisting.
That is pretty succinct. Are either parties, Digital Mars and STLPort, aware of that and attempting to make peace and live amicably together with their child -A ?
All standards are subject to interpretation and DMC++ is no exception (although I happen to like the interpretation.) STLport's objective is a high degree of portability between a lot of compiler platforms; it's full of a lot of compromises. So, no, it's not likely to reconcile -A between DMC and STLport. Of course, you're more than welcome to hack the STLport code, send patches back to stlport.com to reconcile the problems. :-) :-)
I have no idea even what the problem is and why STLport thinks that "'_STLP_DEFAULT_TYPE_PARAM' is already defined". I was hoping someone here could explain that. I still don't know why anything from STLport is even being #included since the code clearly doesn't need or use any #include files. I am pointing to the STLport directory for its include files on the command line, since I am running it from a batch file, but that still should make no difference unless Digital Mars is including files automatically somehow.
Apr 11 2004
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote in
message news:c5a7vd$2bet$1 digitaldaemon.com...
 Notice that I
 have included no files, which makes the error doubly curious.
You can have the compiler include files not in the source with the -HI switch.
Apr 11 2004
parent reply "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5a7vd$2bet$1 digitaldaemon.com...
 Notice that I
 have included no files, which makes the error doubly curious.
You can have the compiler include files not in the source with the -HI switch.
I am not using the -HI switch directly, whatever that is. My compiler switches are -c -A -w- .
Apr 11 2004
parent reply "Walter" <walter digitalmars.com> writes:
"Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote in
message news:c5ccen$2g54$1 digitaldaemon.com...
 Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5a7vd$2bet$1 digitaldaemon.com...
 Notice that I
 have included no files, which makes the error doubly curious.
You can have the compiler include files not in the source with the -HI switch.
I am not using the -HI switch directly, whatever that is. My compiler switches are -c -A -w- .
That is very curious. Do you have a CFLAGS environment variable?
Apr 11 2004
next sibling parent reply "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5ccen$2g54$1 digitaldaemon.com...
 Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5a7vd$2bet$1 digitaldaemon.com...
 Notice that I
 have included no files, which makes the error doubly curious.
You can have the compiler include files not in the source with the -HI switch.
I am not using the -HI switch directly, whatever that is. My compiler switches are -c -A -w- .
That is very curious. Do you have a CFLAGS environment variable?
No. My command line in the batch file looks like: H:\Utilities\DigitalMars\bin\dmc -c -A -w- -oh:\tc\o\dm\TestPrivate.obj -IH: \Utilities\DigitalMars\stlport\stlport TestPrivate.cpp where your compiler has been installed at H:\Utilities\DigitalMars and the TestPrivate.cpp is: "class C { private: void f(); }; class D { friend void C::f(); };" When I compile with: H:\Utilities\DigitalMars\bin\dmc -c -w- -oh:\tc\o\dm\TestPrivate.obj -IH:\Ut ilities\DigitalMars\stlport\stlport TestPrivate.cpp there are no compiler errors. Can you try and duplicate this ? Of course use the -o switch to output to one of your own directories and the IH switch to point to wherever STLport 4.5.3 is on your machine. I am using the latest version of your compiler downloaded from your site.
Apr 12 2004
parent reply "Walter" <walter digitalmars.com> writes:
"Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote in
message news:c5dvid$1t14$1 digitaldaemon.com...
 Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5ccen$2g54$1 digitaldaemon.com...
 Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5a7vd$2bet$1 digitaldaemon.com...
 Notice that I
 have included no files, which makes the error doubly curious.
You can have the compiler include files not in the source with the -HI switch.
I am not using the -HI switch directly, whatever that is. My compiler switches are -c -A -w- .
That is very curious. Do you have a CFLAGS environment variable?
No. My command line in the batch file looks like:
H:\Utilities\DigitalMars\bin\dmc -c -A -w- -oh:\tc\o\dm\TestPrivate.obj -IH:
 \Utilities\DigitalMars\stlport\stlport TestPrivate.cpp
Do you have a blank or newline after the -IH: ?
Apr 12 2004
parent reply "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5dvid$1t14$1 digitaldaemon.com...
 Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5ccen$2g54$1 digitaldaemon.com...
 Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com>
 wrote in message news:c5a7vd$2bet$1 digitaldaemon.com...
 Notice that I
 have included no files, which makes the error doubly curious.
You can have the compiler include files not in the source with the -HI switch.
I am not using the -HI switch directly, whatever that is. My compiler switches are -c -A -w- .
That is very curious. Do you have a CFLAGS environment variable?
No. My command line in the batch file looks like:
H:\Utilities\DigitalMars\bin\dmc -c -A -w- -oh:\tc\o\dm\TestPrivate.obj -IH:
 \Utilities\DigitalMars\stlport\stlport TestPrivate.cpp
Do you have a blank or newline after the -IH: ?
No. It is all on one line but undortunately HTML folds it when I display it in a post. Please test it for yourself if you have STLport 4.5.3 installed and, if yours compiles correctly, I will look into why mine does not.
Apr 12 2004
parent reply "Walter" <walter digitalmars.com> writes:
I see what the problem is now. The attached file goes in
dm\stlport\stlport\config, and replaces stl_dm.h.

Thanks for helping me out with this.

-Walter


begin 666 stl_dm.h
M+R\ 4U1,<&]R="!C;VYF:6=U<F%T:6]N(&9I;&4 9F]R($1I9VET86P 36%R





M3%!?3D]?3D%-15-004-%4PT*(R!D969I;F4 7U-43%!?3D]?4D5,3U!37TY!

M(&1E9FEN92!?4U1,4%]614Y$3U)?1TQ/0D%,7U-41 T*(R!D969I;F4 7U-4








M;W0 ;6%N9&%T;W)Y+"!J=7-T(&5N86)L960-"B, =6YD968 7U-43%!?55-%



M=6YS:6=N960 ,S(M8FET(&EN=&5G97( ='EP90T*(R  9&5F:6YE(%]35$Q0











M3TY?4U!%0PT*(R  =6YD968 7U-43%!?5T5!2U]!5%1224)55$4-"B, ('5N

M14U03%]"05-%7TU!5$-(7T)51PT*(R  =6YD968 7U-43%!?3D535$5$7U19

M4 T*(R  =6YD968 7U-43%!?54Y)3DE424%,25I!0DQ%7U!2259!5$4-"B, 
M('5N9&5F(%]35$Q07T)!4T5?5%E0141%1E]"54<-"B, ('5N9&5F(%]35$Q0
M7T)!4T5?5%E0141%1E]/5513241%7T)51PT*(R  =6YD968 7U-43%!?0T].





M04Q?34%87T))5%, /CT -C0-"B, ("!D969I;F4 7U-43%!?3$].1U],3TY'
M(&QO;F< ;&]N9PT*(R  96YD:68-" T*(R  =6YD968 7U-43%!?3D]?3$].
M1U]$3U5"3$4-"B, ('5N9&5F(%]35$Q07TY%141?355404),10T*(R  =6YD

M(&1E9FEN92!?4U1,4%].3U]"041?04Q,3T,-"B, ('5N9&5F(%]35$Q07T1%




M4U1,4%].3U]154%,249)141?1E))14Y$4PT*(R  =6YD968 7U-43%!?3D]?


M4%]!551/34%424-?5%E015]44D%)5%,-"B, ('5N9&5F(%]35$Q07TU%34)%
M4E]03TE.5$527U!!4D%-7T)51PT*(R  =6YD968 7U-43%!?3D].7U194$5?
M5$U03%]005)!35]"54<-"B, ('5N9&5F(%]35$Q07TY/7T1%1D%53%1?3D].







M,' X,S0-"B, ('5N9&5F(%]35$Q07TY/7T580T505$E/3E](14%$15(-"B-E



M9FEN92!?4U1,4%](05-?3D]?3D577T-?2$5!1$524PT*(R  9&5F:6YE(%]3
M5$Q07U1(4D]77U)%5%523E]"54<-"B, ('5N9&5F(%]35$Q07TQ)3DM?5$E-

M3D5%1%-?5$5-4$Q!5$5?05)'4PT*(R  =6YD968 7U-43%!?3D]?5$5-4$Q!
M5$5?0T].5D524TE/3E,-"B, ('5N9&5F(%]35$Q07TY%14137T585%)!7U1%


M14-,4U!%0R!?7V1E8VQS<&5C*&1L;&5X<&]R="D-"B, (&1E9FEN92!?4U1,




M3%!?24U03U)47U1%35!,051%7TM%65=/4D0 7U]D96-L<W!E8RAD;&QI;7!O


M7TA%041%4BAH96%D97(I("  (#PN+B]I;F-L=61E+R,C:&5A9&5R/ T*(V1E
M9FEN92!?4U1,4%].051)5D5?0U](14%$15(H:&5A9&5R*2  (" \+BXO:6YC

M041%4BAH96%D97(I("  (#PN+B]I;F-L=61E+R,C:&5A9&5R/ T*(V1E9FEN
M92!?4U1,4%].051)5D5?3TQ$7U-44D5!35-?2$5!1$52*&AE861E<BD /"XN

M4E5.5$E-15](14%$15(H:&5A9&5R*2 \+BXO:6YC;'5D92\C(VAE861E<CX-




M7T)524Q$24Y'7U-43%!/4E0I("8F("%D969I;F5D("A?4U1,4%].3U]/5TY?
M24]35%)%04U3*0T*(R  :68 *&1E9FEN960 *%]$3$PI("8F("%D969I;F5D
M("A?4U1,4%]$3TY47U5315]$3$PI*2!\?"!D969I;F5D("A?4U1,4%]54T5?






M<W1L9&5B=6=?<W1A=&EC>"YL:6(B*0T*(R  ("!E;F1I9 T*(R  (&5L<V4-
M"B, ("  :68 9&5F:6YE9" H7U-43%!?55-%7T1,3"D-"B, ("  ('!R86=M




M"B, ("  :68 (61E9FEN960 *%]35$Q07T1/3E1?55-%7T1,3"D-"B, ("  



M("!I9B!D969I;F5D("A?4U1,4%]54T5?1$Q,*0T*(R  ("  <')A9VUA(&-O


M:6,N;&EB(BD-"B, ("  96YD:68-"B, ("!E;F1I9 T*(R  96QS90T*(R  




M<V4-"B, ("  :68 9&5F:6YE9" H7U-43%!?55-%7T1,3"D-"B, ("  ('!R





M"B\O('-T:6QL(&YE961E9"!F;W( 8G5I;&1I;F< 4U1,<&]R="!I='-E;&8L



M*%]?4U1,4%].3U]+15E73U)$4U]73U)+05)/54Y$*0T*(R!D969I;F4 7U]I


`
end
Apr 12 2004
parent reply "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Walter wrote:
 I see what the problem is now. The attached file goes in
 dm\stlport\stlport\config, and replaces stl_dm.h.

 Thanks for helping me out with this.
Your welcome. I see what you have done, setting However, that leads to a few more questions: 1) What causes this file to be included.long with _config.h, when I am not including anything in my source file ? 2) It seems as if line 369 in stlport\stlport\stl\_config.h is in error and the sequence there should be instead: #if defined(_STLP_DEFAULT_TYPE_PARAM) #undef _STLP_DEFAULT_TYPE_PARAM #endif Of course this is not your problem. 3) There is a discussion on whether the source file does indeed have an error in comp.lang.c++. Among the many C++ compilers in which I am able to try this out, Comeau and the latest C++BuilderX compiler from Borland give an error in strict Ansi mode, saying that "function "C::f" is inaccessible" in the expression "function "C::f", while VC6,7,7.1,8.0, GCC3.3.1, C++Builder 3,4,5,6, and your compiler do not flag any errors in strict Ansi mode. In non-strict Ansi mode no compiler flags the code as an error. What is your understanding of this ?
Apr 12 2004
parent reply "Walter" <walter digitalmars.com> writes:
"Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote in
message news:c5fckj$1ioo$1 digitaldaemon.com...
 1) What causes this file to be included.long with _config.h, when I am not
 including anything in my source file ?
The -A means RTTI is supported, to do rtti requires that typeinfo be included.
 2) It seems as if line 369 in stlport\stlport\stl\_config.h is in error
and
 the sequence there should be instead:

 #if defined(_STLP_DEFAULT_TYPE_PARAM)
 #undef _STLP_DEFAULT_TYPE_PARAM
 #endif


 Of course this is not your problem.
The other definitions of _STL__DEFAULT_TYPE_PARAM all set it to 1, so stl_dm.h was just inconsistent with them.
 3) There is a discussion on whether the source file does indeed have an
 error in comp.lang.c++. Among the many C++ compilers in which I am able to
 try this out, Comeau and the latest C++BuilderX compiler from Borland give
 an error in strict Ansi mode, saying that "function "C::f" is
inaccessible"
 in the expression "function "C::f", while VC6,7,7.1,8.0, GCC3.3.1,
 C++Builder 3,4,5,6, and your compiler do not flag any errors in strict
Ansi
 mode. In non-strict Ansi mode no compiler flags the code as an error. What
 is your understanding of this ?
I'm unconvinced either is right yet.
Apr 12 2004
parent reply "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
Walter wrote:
 "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote
 in message news:c5fckj$1ioo$1 digitaldaemon.com...
 1) What causes this file to be included.long with _config.h, when I
 am not including anything in my source file ?
The -A means RTTI is supported, to do rtti requires that typeinfo be included.
Even if I never use typeid or type_info myself ? That is strange to me. Perhaps it should be documented when a compile includes header files which a programmer does not.
 2) It seems as if line 369 in stlport\stlport\stl\_config.h is in
 error and the sequence there should be instead:

 #if defined(_STLP_DEFAULT_TYPE_PARAM)
 #undef _STLP_DEFAULT_TYPE_PARAM
 #endif


 Of course this is not your problem.
The other definitions of _STL__DEFAULT_TYPE_PARAM all set it to 1, so stl_dm.h was just inconsistent with them.
But the corrected lines above prevent the compiler error no matter if _STL__DEFAULT_TYPE_PARAM is set or not or what it is set to. Anyway it is a moot point. I can always suggest this to STLport.
 3) There is a discussion on whether the source file does indeed have
 an error in comp.lang.c++. Among the many C++ compilers in which I
 am able to try this out, Comeau and the latest C++BuilderX compiler
 from Borland give an error in strict Ansi mode, saying that
 "function "C::f" is inaccessible" in the expression "function
 "C::f", while VC6,7,7.1,8.0, GCC3.3.1, C++Builder 3,4,5,6, and your
 compiler do not flag any errors in strict Ansi mode. In non-strict
 Ansi mode no compiler flags the code as an error. What is your
 understanding of this ?
I'm unconvinced either is right yet.
Evidently the DM compiler is convinced that it is legal to use the construct. I tend to favor the opposite idea that class D can not access a private member of class C even if it is just to make that member a friend of itself. I have always philosophically viewed "private" as: "hands off" except by the class members or friends of the class itself.
Apr 12 2004
parent "Walter" <walter digitalmars.com> writes:
"Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> wrote in
message news:c5fvj6$2glq$1 digitaldaemon.com...
 Evidently the DM compiler is convinced that it is legal to use the
 construct. I tend to favor the opposite idea that class D can not access a
 private member of class C even if it is just to make that member a friend
of
 itself. I have always philosophically viewed "private" as: "hands off"
 except by the class members or friends of the class itself.
In C++, there is the right way, the wrong way, and what the Standard says!
Apr 13 2004
prev sibling parent reply "KTC" <me here.com> writes:
"Walter" <walter digitalmars.com> wrote in message
news:c5dbok$tn8$1 digitaldaemon.com...
 "Edward Diener" wrote
 I am not using the -HI switch directly, whatever that is. My compiler
 switches are -c -A -w- .
That is very curious. Do you have a CFLAGS environment variable?
Error reproduced using a band new installation of DMC unzipped into default directory (I've just reformatted my comp, so no envir set at all). \dm\bin\dmc -c -A -w- -o\dm\projects\Quick_Test.obj -I\dm\stlport\stlport\ Quick_Test.cpp KTC -- Experience is a good school but the fees are high. - Heinrich Heine
Apr 12 2004
parent "Edward Diener" <eddielee_no_spam_here_and_now tropicsoft.com> writes:
KTC wrote:
 "Walter" <walter digitalmars.com> wrote in message
 news:c5dbok$tn8$1 digitaldaemon.com...
 "Edward Diener" wrote
 I am not using the -HI switch directly, whatever that is. My
 compiler switches are -c -A -w- .
That is very curious. Do you have a CFLAGS environment variable?
Error reproduced using a band new installation of DMC unzipped into default directory (I've just reformatted my comp, so no envir set at all). \dm\bin\dmc -c -A -w- -o\dm\projects\Quick_Test.obj -I\dm\stlport\stlport\ Quick_Test.cpp
Thanks ! At least it is a bug which can be duplicated.
Apr 12 2004