निम्नलिखित प्रोग्राम मेरे लिए बहुत ठीक दिखता है। लेकिन मैं इसे संकलित नहीं कर सकता।संरचनाओं के वेक्टर
#include <iostream>
#include <vector>
using namespace std;
int main()
{
struct a
{
int i;
int j;
};
std::vector<a*> vecA;
a* pA = new a;
pA->i = 4;
pA->j = 9;
vecA.push_back(pA);
return 0;
}
यह निम्न त्रुटि उत्पन्न करता है।
struct_update.cc: In function ‘int main()’:
struct_update.cc:32:19: error: template argument for ‘template<class _Alloc> class std::allocator’ uses local type ‘main()::a*’
struct_update.cc:32:19: error: trying to instantiate ‘template<class _Alloc> class std::allocator’
struct_update.cc:32:19: error: template argument 2 is invalid
struct_update.cc:32:25: error: invalid type in declaration before ‘;’ token
struct_update.cc:39:10: error: request for member ‘push_back’ in ‘vecA’, which is of non-class type ‘int’
मेरे लिए ठीक संकलित ... (विजुअल स्टूडियो 2010 SP1) – Mysticial
@honk कोड से ऊपर जी ++ (आज तक ubuntu 11.10 के लिए नवीनतम संस्करण उपलब्ध है) के साथ काम नहीं करता है – Dilawar