|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
When I compile this code:
std::vector <char*> TSTrow[TESTnum]; .... char *tmp=new char[32]; sprintf(tmp, ...); TSTrow[(int)lpParam].push_back(tmp); I get this error: "E2316 'push_back' is not a member of 'std::vector<char *,std::allocator<char *> >'" but 'push_back' *is* a member of std::vector! Does it make any sense? When I use VC++ 2005 Express Edition I don't get any error. Could somebody me? Thanks Cristiano |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Cristiano wrote:
> When I compile this code: > > std::vector <char*> TSTrow[TESTnum]; That's an array of vectors to pointers to char. > ... > char *tmp=new char[32]; sprintf(tmp, ...); > TSTrow[(int)lpParam].push_back(tmp); > > I get this error: > "E2316 'push_back' is not a member of 'std::vector<char > *,std::allocator<char *> >'" > > but 'push_back' *is* a member of std::vector! Does it make any sense? If the compiler doesn't know what that class (the instantiation of the 'std::vector' template for 'char*') has as members, it will not let you use any expression after the dot. > When I use VC++ 2005 Express Edition I don't get any error. > Could somebody me? Are you sure you've included the necessary headers? It is likely that VC++ includes the missing header behind the scenes, but you shouldn't rely on that. Next time, please follow the recommendations of FAQ 5.8 V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Victor Bazarov wrote:
> Are you sure you've included the necessary headers? It is likely > that VC++ includes the missing header behind the scenes, but you > shouldn't rely on that. I #included <vector>, it should be enough, right? > Next time, please follow the recommendations of FAQ 5.8 Where are the FAQ? Cristiano |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Cristiano wrote:
> Victor Bazarov wrote: >> Are you sure you've included the necessary headers? It is likely >> that VC++ includes the missing header behind the scenes, but you >> shouldn't rely on that. > > I #included <vector>, it should be enough, right? > >> Next time, please follow the recommendations of FAQ 5.8 > > Where are the FAQ? http://www.parashift.com/c++-faq-lite/ V -- Please remove capital 'A's when replying by e-mail I do not respond to top-posted replies, please don't ask |
|
![]() |
| Outils de la discussion | |
|
|