Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C++ Vector Implementation

td611

New Coder
I declare a vector of object Persons

C++:
#ifndef PostO_H
#define PostO_H
#include "Person.h"
#include "Address.h"
#include <iostream>
#include <string>
using namespace std;
class PostO
{
private:
vector <Person> mList[];

When I do so, I get this error, underlining mList.

"incomplete type is not allowed"

What does this mean, and how do I resolve it?
 
Last edited by a moderator:
You may need to #include <vector> if it hasn't been included in any of the other header files.
You should also be able to declare vector<Person> mList; without the brackets - your declaration is defining an array of vectors but without a given array size (maybe that's the problem?). So instead of mList[3].push_back(aPerson); I think your intention is mList.push_back(aPerson);.
 
Hi there,

Welcome to Code Forum!

I'm glad you got a solution for this! Can you please mark @Krusty the Senile posts as the solution?

Also, please make sure you wrap all code within our Code BBCode function. I have done it for you this time.
 
Back
Top Bottom