c++ - Header file compiles multiple times and gets random errors at every compile after the first compile -


when go build c++ project, 53 errors. however, it's same list of errors 4 times in row 1 of 5 header files have in project. checked output , found attempted compile 1 header file 5 times. appears first time successful. other 4 times got errors, same errors on , on again. followed includes of lead to. based on of places include header file, makes sense try compile every time it's included.

this header file that's getting compiled multiple times. first successful compile makes sense, don't understand why it's getting bunch of errors every other time compiles while building project:

#ifndef transaction_h #define transaction_h  #include <string> #include "account.h" #include "bstree.h"  using namespace std;  class transaction { public:     transaction();     transaction(char type, string firstname, string lastname, int id, account* account1, int fund1, account* account2, int fund2, int amount);     ~transaction();     void setptraccounts(bstree* ptraccounts);     bool transact(); private:     static bstree* ptraccounts;     char type;     string firstname;     string lastname;     int id;     account* account1;     int fund1;     account* account2;     int fund2;     int amount;     void deposit();     void history();     void open();     bool transfer();     bool withdraw(); };  #endif 

here's repeating list of errors. these errors bogus. there's nothing wrong code in above header file:

error c2061: syntax error : identifier 'account' \thejollybanker\transaction.h 14 1

error c2061: syntax error : identifier 'bstree' \thejollybanker\transaction.h 16 1

error c2143: syntax error : missing ';' before '*' \thejollybanker\transaction.h 19 1

error c4430: missing type specifier - int assumed. \thejollybanker\transaction.h 19 1

error c2143: syntax error : missing ';' before '*' \thejollybanker\transaction.h 24 1

error c4430: missing type specifier - int assumed. note: c++ not support default-int \thejollybanker\transaction.h 24 1

error c2143: syntax error : missing ';' before '*' \thejollybanker\transaction.h 26 1

error c4430: missing type specifier - int assumed. note: c++ not support default-int \thejollybanker\transaction.h 26 1

here's summary of output window:

transaction.cpp

thejollybanker.cpp

transaction.h errors

fund.cpp

bstree.cpp

transaction.h errors

bank.h

transaction.h errors

account.cpp

transaction.h errors

generating code...

how compile once compiles first time?

string part of namespace std. replace string std::string everywhere in header, should work.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -