I have searched quite thoroughly on this but can't seem to find an answer.
I have a "bank" class that naturally has a vector. here is one of the functions with the problematic part:
int bank::open(op *o, int id)
{
account *acc = new account();
if (search(o->account))
return ACCOUNT_EXISTS;
accounts.push_back(acc->open(o, id));
}
and i get a "syntax error : identifier 'account' and "'acc' : undeclared identifier error.
this .cpp has
#include "bank.h"
which has #include "bank_account.h"
(which is the banks personal account) which has #include "account.h"
, and there is absolutely no way for a circular reference.
if I type account::
the scope is visible, and if I right click and search for the declaration it (VS 2008) finds it.
here is the account.h
class declaration
class account
{
public:
account(void) {}
~account(void) {}
int number;
int password;
int bal;
//void openAccount(op *o, int id);
void deposit(int amount, int id);
int withdraw(int amount, int id);
void balance(int id);
void close(int id);
int comission(float percentage);
void log(int msg, int id, int amount=0);
};
Thanks for any help...
First, on this line:
accounts.push_back(acc->open(o, id));
You are calling acc->open()
, and acc
is of type account*
.
But I do not see any definition for method open
in class account
.
Therefore, you cannot call the open
via the acc
pointer.
The closest match is the method openAccount
, but that is currently commented out, and cannot be used.
accounts.push_back()
.bank
does not have a member accounts
.