How to port from libg++ 2.7.2's libstdc++ to egcs'

Christian Joensson FOA 72 chj@lin.foa.se
Wed Nov 19 01:46:00 GMT 1997


I'm not really a C++ programmer, but rather a user of C++ code. I have a bunch 
of C++ code, i.e., developed with GNU's c++ and the libstdc++ from 2.7.2, and 
of course I cannot compile it using the egcs' c++ compiler (new standard etc.).

The question I have is, I guess, this; how does one ``port'' such old designed 
code into the new design?

As I said, I'm no C++ programmer, and I guess I shouldn't bother then, right?

I'm running egcs' c++ with the same options as GNU's c++-2.7.2, -c 
-fno-implicit-templates -Wall -ansi -Winline -pipe -fno-nonnull-objects 
-Woverloaded-virtual -pedantic -W -O2 -g.

Let me point you to an example. In a piece of code I'm using, there are these 
problems:

/home/chj/egcs/src/dv90-0.9beta/libdv90i/include/Dv90ObjCntPtr.h:19: parse 
error before `<'
In file included from /home/chj/egcs/src/dv90-0.9beta/libdv90i/include/Dv90Pola
rArea.h:7,
                 from Dv90PolarArea.cc:1:
/home/chj/egcs/src/dv90-0.9beta/libdv90i/include/Dv90Bearings.h:87: `struct 
Dv90ObjCntPtr' redeclared as different kind of symbol
/home/chj/egcs/src/dv90-0.9beta/libdv90i/include/Dv90ObjCntPtr.h:104: previous 
declaration of `template <class T> class Dv90ObjCntPtr<T>'
/home/chj/egcs/src/dv90-0.9beta/libdv90i/include/Dv90ObjCntPtr.h: In method 
`class F77Array2d<int> & Dv90ObjCntPtr<F77Array2d<int> >::operator *() const':
/home/chj/egcs/src/dv90-0.9beta/libdv90i/include/Dv90ObjCntPtr.h:266: member 
`the_p' is private
/home/chj/egcs/src/dv90-0.9beta/libdv90i/include/Dv90ObjCntPtr.h:266: warning: 
control reaches end of non-void function `Dv90ObjCntPtr<F77Array2d<int> >
::operator *() const'
make[1]: *** [Dv90PolarArea.o] Error 1

There's obviously a problem with the template definition in the file 
Dv90ObjCntPtr.h on lines 16 thru 19, especially 19. Perhaps, the problems in 
Dv90Bearings.h on line 87 and in Dv90ObjCntPtr.h on line 104 really follows 
from the previous problem, but I don't know.

Then, an other re-occurring problem shows up in Dv90ObjCntPtr.h lines 265 and 
266, the dereferencing operator has the pointer private. But, then again, 
perhaps the problem follows from the first problem mentioned.

Well, my issue is, here, not my specific problems, but the main question is 
rather what fools like I could do? Could we be held in the hand by some 
document or can't we do anything? (Get a *real* C++ programmer?)

TIA for any discussion, or even help on my specific problem.

/ChJ


More information about the Gcc mailing list