I have some legacy C++ code (used to compile using GNU g++ 2.95.3) having the following declaration std::basic_string<char,string_char_traits<char>,malloc_alloc> x;
The header file was
#include <std/bastring.h>
Now, I am migrating to GU g++ 4.9 where I'm getting this error:
1. std/bastring.h
not found
2. When I change #include <std/bastring.h>
as #include <string>
, I'm getting the following error:
error: 'string_char_traits' was not declared in this scope
std::basic_string<char,string_char_traits<char>,malloc_alloc> x;
error: template argument 2 is invalid
std::basic_string<char,string_char_traits<char>,malloc_alloc> x;
error: expected unqualified-id before ',' token
std::basic_string<char,string_char_traits<char>,malloc_alloc> x;
^
Need guidance / help to make this compilable under GNU g++ 4.9
Despite the publication of ISO/IEC 14882:1998, GCC 2.95.3 is very much not a C++98 conforming compiler. We're talking about a 15 year old compiler running on the coattails of god awful who-knows-what non-standard code from the '90s. For one thing, here's a snippet from
bastring.h
:I don't know what
ANSI X3J16/94-0013R2
but it definitely has nothing to do with ISO C++98.malloc_alloc
is found inalloc.h
, if for some reason you want to explicitly wantmalloc
andfree
to to be used in the allocator.Anyways, your codebase is no doubt going to have to be rewritten from scratch.
std::basic_string<char,string_char_traits<char>,malloc_alloc> x;
can be replaced withstd::string
. But I shudder at the horrors of what other pre-standard code lies in there.