LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Classes in VC++ (https://www.linuxquestions.org/questions/programming-9/classes-in-vc-387852/)

Diederick 11-30-2005 05:32 AM

Classes in VC++
 
I am using Visual Studio C++, and i want to create an array of objects. I want to use a vector to store my objects. Firstly, I have created the following in my program, between the auto generated code:

class abc{
private:
int var1;
int var2;
char var3;
public:
};

and now I want to create the vector by saying:

voctor<abc> myVector(5);

but the errors i get is:

1. syntax error: missing ';' before '<'
2. missing storage-class or type specifier.

Can you help me please, I don't know VC++ that well, and I need to solve this problem.

Thank You.

dmail 11-30-2005 07:55 AM

Re: Classes in VC++
 
Quote:

Originally posted by Diederick
I am using Visual Studio C++, and i want to create an array of objects. I want to use a vector to store my objects. Firstly, I have created the following in my program, between the auto generated code:

class abc{
private:
int var1;
int var2;
char var3;
public:
};

and now I want to create the vector by saying:

voctor<abc> myVector(5);

but the errors i get is:

1. syntax error: missing ';' before '<'
2. missing storage-class or type specifier.

Can you help me please, I don't know VC++ that well, and I need to solve this problem.

Thank You.

voctor<abc> myVector(5); <<im not usre what you are trying to do here

#include <vector.h>

std::vector<abc>myVector;
you may have missed the namespace qualifier out.

paulsm4 11-30-2005 10:57 AM

Or misspelled "vector"...


All times are GMT -5. The time now is 05:27 AM.