[geeks] VC++ STL vector
Jonathan C. Patschke
jp at celestrion.net
Wed Sep 25 14:22:41 CDT 2002
On Wed, 25 Sep 2002, Joshua D Boyd wrote:
> Alright, I do
> #include <vector>
> in a program in VC++.
>
> vector <int> i;
ITYM std::vector, unless you have "using namespace std;" near the top of
the source or header file.
> WTF? This same program, using the STL vector works fine at home under
> GCC 2.95. How can it be loaded the vector header file but not reading
> the class definition?
GCC 2.95 does not properly respect the std namespace. Many things are
just tossed in :: instead of std::.
I think the best way to solve this would be to, in a header file:
#ifdef __GNUC__
# if (__GNUC__ < 3)
/* We don't need namespace std */
# else
using namespace std;
# endif
#else
using namespace std;
#endif
I don't have access to VC++ or GCC 2.95 right now, but that should `fix'
the problem.
--
Jonathan Patschke
> Can you SysAdmins tell me what might go on in a typical day?
Hours of endless frustration punctuated by moments of sheer terror.
--Saul Tannenbaum (in the Monastery)
More information about the geeks
mailing list