On Mon, 4 Jul 2005, Yang Shuichao wrote:
I am a new bie to C++ programming under Linux.I am requried to port some
software from Redhat linux 7.3(with g++ version 2.9.6) to fedora core
three(with g++ version 3.4.2). The original source code was complied
successfully in Redhat but failed under fedora.I found the system header
files included in my software were implemented differently in these two
system and even their PATH are different too. I copied from Redhat all
the header files to my fedora system and recompiled them under fedora
with the same options used in redhat, but still got many many errors
like below: ./usrinclude/g++-3/std/straits.h:108: error: an explicit
specialization must be preceded by 'template <>'
./usrinclude/pthread.h:163: error: expected `,' or `...' before
"__thread" ./usrinclude/pthread.h:591: error: storage class specifiers
invalid in parameter declarations ./usrinclude/pthread.h:591: error:
storage class specified for parameter `parameter'
./usrinclude/g++-3/stl_alloc.h:701: error: expected constructor, destructor, or type conversion before '*' token
./usrinclude/g++-3/stl_alloc.h:701: error: expected `;' before '*' token
./usrinclude/g++-3/stl_alloc.h:961: error: non-template `rebind' used as template
What shall I do? Can anybody help me? Great thanks.
If you are compiling with gcc-3.4, you must use the gcc-3.4 system
headers. Also, you should never use these "hidden" header files such as
straits.h and stl_alloc.h that you mention (though you may see references
to them from standard header files that you did include, if you included
2.96 versions).
There are some significant changes between g++-2.96 and gcc-3.4 in terms
of how strictly the compiler enforces standard langauge constructs. If
you had a program that compiled under 2.96 and doesn't under 3.4, it is
likely that the program contains incorrect C++ and you'll have to go
through with a recent C++ book and correct the errors.
In FC3, there were compat-gcc and compat-libstdc++ packages that (IIRC)
still compiled 2.96 code. A *temporary* solution would be to install
those packages and compile your app with them. But in the long run, you
will need to fix your code to conform to standard C++.
--
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs