a problem with declaring a vector pointer

M

Milan Krejci

in myqtapp.h i have following declaration:
typedef std::vector <LCDRange *> vecLCD;
vecLCD *vec;
and in myqtapp.cpp i have following implementation:
vec=new vecLCD;
vec.push_back(lcdRange);

but i am getting a compilation error
myqtapp.cpp:219: error: `push_back' has not been declared
myqtapp.cpp:219: error: request for member of non-aggregate type before
'(' token
 
G

Gianni Mariani

Milan said:
in myqtapp.h i have following declaration:
typedef std::vector <LCDRange *> vecLCD;
vecLCD *vec;
and in myqtapp.cpp i have following implementation:
vec=new vecLCD;
vec.push_back(lcdRange);

try:
vec->push_back(lcdRange);

.... you need to dereference the pointer vec.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,705
Latest member
Stefkari24

Latest Threads

Top