(John) wrote in message news:< om>...
> Hi all:
>
> I am using a code from third party. I write my own part and add it to
> that code and compile together.
> I try to use "vector" in my program. So I add "#include <vector>" to
> my program.
> But when I compile my program together with the code from the third
> party,
> the compiler reports error: redefinition of `class vector'.
>
> I look at the code from the third party and find that in one file of
> that code,
> "class vector" is defined for other purpose.
> I can not modify the code from the third party, because it may make
> the situation worse.
> What should I do to my own program to solve the name confliction
> problem?
Well, the vector template that is defined in <vector> resides in
namespace std, so you should still be able to use it even in the
presence of the other vector class by specifying std::vector instead
of just vector. Note also that getting rid of using directives (e.g.
using namespace std) is generally a good idea, and will help identify
more name collisions between std::vector and your vendors' vector as
well.
HTH, Dave Moore
> Thanks a lot.
>
> John