| Author |
What is this error?
|
|
|
| Hello,
I am beginner in STL and never use it in MSVC. I am developing an
application DLL that I have a template for it which is based on STL. When I
am trying to compile the template I will get the following error for this
line of code. What is the problem and how can I solve it? Is it related to
the way that I setup my MSVC?
I am using MSVC 6 on window XP sp1:
Line that generate error:
typedef vector<string>::value_type value_type;
Error message:
error C2653: 'vector<class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >,class
std::allocator<class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > > >' : is not a class or
namespace name
I check and it seems that vector is included to the file.
Best regards
| |
| Ulrich Eckhardt 2005-02-14, 9:11 pm |
| MA wrote:
> Line that generate error:
>
> typedef vector<string>::value_type value_type;
That should be
std::vector<std::string>
but that's not the problem as the error message shows[slightly reformatted]:
> error C2653:
> 'vector<std::string, std::allocator<std::string> >'
> is not a class or namespace name
>
> I check and it seems that vector is included to the file.
Double-check that. Also make sure you have the missing 'std::' or using
directives in the code.
Uli
| |
| John Smith 2005-02-14, 9:11 pm |
| Hi,
You can applend following code in the begin of the file:
#include <vector>
using namespace std;
"Ulrich Eckhardt" <doomster@knuut.de>
??????:351fmdF4flf5iU1@individual.net...
> MA wrote:
>
> That should be
> std::vector<std::string>
> but that's not the problem as the error message shows[slightly
reformatted]:
>
>
> Double-check that. Also make sure you have the missing 'std::' or using
> directives in the code.
>
> Uli
>
| |
| Markus Ewald 2005-02-14, 9:11 pm |
| "John Smith" <tjshif@citiz.net> wrote in message
news:Om0xUBR$EHA.2572@tk2msftngp13.phx.gbl...
> Hi,
> You can applend following code in the begin of the file:
>
> #include <vector>
> using namespace std;
>
This will of course cause any other file which includes this header to also
import "std" namespace. That's why, in general, it is a strongly discouraged
practice.
-Markus-
| |
| Jeff F 2005-02-14, 9:11 pm |
| Markus Ewald wrote:
> "John Smith" <tjshif@citiz.net> wrote in message
> news:Om0xUBR$EHA.2572@tk2msftngp13.phx.gbl...
> This will of course cause any other file which includes this header
I could find no reference to the code being in a header in the OP, or any of
the respondents replies.
> to also import "std" namespace. That's why, in general, it is a
> strongly discouraged practice.
Jeff
| |
| Stephen Howe 2005-02-14, 9:11 pm |
| > This will of course cause any other file which includes this header
What header?
I don't see anywhere where "header" is mentioned.
But I agree with you if it is is a header file.
Stephen Howe
|
|
|
|