Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Size of @_STL@%vector%78_STL@... is unknown or zero

 

Compile error.

 

 

 

 

 

Full error message

 

[C++ Error] Size of @_STL@%vector%78_STL@%pair$63_STL@%basic_string$c20_STL@char_traits$c%18_STL@allocator$c%%i%97_STL@%allocator$78_STL@$pair$63_STL@%basic_string$c20_STL@ is unknown or zero

 

 

 

 

 

Cause

 

IDE: C++ Builder 6.0

Compiler: Borland BCC32.EXE version 6.0.10.157

Project type: Console Application

Libraries used:

 

 

 

 

 

Source code

 

struct MyForm : public TForm
{
  void std::vector<std::pair<std::string,int> > question_scores;
};

 

The cause is that the member variable question_scores is of type 'std::vector<std::pair<std::string,int> >', instead of 'void std::vector<std::pair<std::string,int> >' (void is used erroneously).

 

 

 

 

 

Solution

 

Remove the 'void' keyword:

 

struct MyForm : public TForm
{
  std::vector<std::pair<std::string,int> > question_scores;
};

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict