My object has an incomplete type?

Aug 7, 2012 at 8:39pm
So I'm trying to create a program where I can create an account for whatever and set a password for it. I'm more or less of a newbie at coding in c++, so this is kind of a long shot and I doubt I'll be able to make this work, but hey, whateves. But the error I'm currently working with is this bit of code here. I have a class called Account and I'm trying to make an object for it, like so:
Account AccountObj;

But the error I get is like so:
error: aggregate 'Account AccountObj' has incomplete type and cannot be defined


What could possibly be happening?
Aug 7, 2012 at 8:44pm
Please post a the full Account header or whatever it is declared in :)
Aug 7, 2012 at 8:45pm
You have not shown your class definition so I can only guess that its definition has a member with incomplete type/ For example

1
2
3
4
5
6
struct A;

struct B
{
   A a;
};


Here class B has member a with incomplete type because class A was not defined yet. Or another example

1
2
3
4
struct A
{
   int arr[];
};


Here class A also has a member with incomplete type because the size of the arr is not specified.
Aug 7, 2012 at 8:49pm
Oook, so chances are that its a problem with my account class? should I post my whole class or just this:
#include "Account.h.h"

I think I might have named my class 'Account.h' by complete accident, but whenever I make an object of the class like this:
Account.h accountObj;

It doesn't work. I'm so very confuzed.
Please tell me if I should post my whole program.
Aug 7, 2012 at 8:57pm
Why do you use two extensions for the header file?

You should show your class definition that is all its member declarations between open and closing braces.
Last edited on Aug 7, 2012 at 9:07pm
Aug 7, 2012 at 9:00pm
Sorry, haha I might be a lot newer than you think. what are extensions for the header file?

whats the class definition?

I can post the whole program if you want me to...
Aug 7, 2012 at 9:05pm
Oh nvm I just fixed it haha thnx for trying guys!
Topic archived. No new replies allowed.