> Yes, that occurs if you have a
>
> using namespace std;
>
> statement in your code, and you are using Microsoft Visual C++ 6 (it's
> actually a compiler bug).
>
> Removing (or possibly moving until after all your includes, or just
> re-ordering your includes) the using statement will fix the issue.
>
Thanks very much for that hint John,
I found two places in our header which are using the "using namespace std;". After I have switched that to the explicit "using" statements I could also switch back to your default "user.hpp".
Perhaps I can ask one more question about this strange behaviour, just because I want to understand why:
I try to use my own string class, which is inherited from std::string. Defining "VC6_STUPID_BEHAVIOUR" in the example code below compile and run the code successfuly, using the expanded name leads to following compiler error:
error C2614: 'MyCString' : illegal member initialization: 'string' is not a base or member
You know WHY??? Also because of the same compiler error in VC6 or is there something else wrong.
On Solaris and HP-UX it works fine in every combination.
// vvvvvvvvvvvvvvv snipp vvvvvvvvvvvvvvvv
#include <string>
#include <iostream>
#ifdef VC6_STUPID_BEHAVIOUR
using std::string;
# define std_string string
#else
# define std_string std::string
#endif
class MyCString
: public std_string
{
public:
MyCString(const char *s_);
: std_string(s_)
{
std::cout << "\"" << *this << "\"" << std::endl;
};
};
int main (int argc, char *argv[])
{
MyCString s(argv[0]);
return 0;
}
// ^^^^^^^^^^^^ snipp ^^^^^^^^^^^^