Thread: PLEASE HELP!! error C2228

  1. #31
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Hmm... that is strange, since you really should have gotten an error message about makeDeposit and makeWithdraw. Anyway, fix those first and see. Next time, instead of writing everything at once, write a small amount of code, compile (and test), then write more code, etc.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #32
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Please cut and paste the current error; your last post of the error looks wrong to me.
    Edit: It looked like a cut and paste error or you have a folder the same name as your header file.

    Tim S.
    Last edited by stahta01; 03-27-2013 at 09:33 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #33
    Registered User
    Join Date
    Mar 2013
    Posts
    17
    Quote Originally Posted by stahta01 View Post
    Please cut and paste the current error; your last post of the error looks wrong to me.

    Tim S.
    this is the error.

    ------ Build started: Project: BankAccount.h, Configuration: Debug Win32 ------
    Compiling...
    TestBankAccount.cpp
    c:\users\william\documents\visual studio 2008\projects\bankaccount.h\bankaccount.h\testbank account.cpp(38) : error C2228: left of '.getBalance' must have class/struct/union
    Build log was saved at "file://c:\Users\William\Documents\Visual Studio 2008\Projects\BankAccount.h\BankAccount.h\Debug\Bu ildLog.htm"
    BankAccount.h - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  4. #34
    Registered User
    Join Date
    Mar 2013
    Posts
    17
    i ran the program on ideone.com, and it compiles, but it doesn't compile on Visual Studio.

    so is it my compiler that is crap ?

  5. #35
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by 5.5.7. Will
    so is it my compiler that is crap ?
    If you are using MS Visual Studio 2005 or later, the compiler (MSVC8 or later) should be okay. My guess is that somehow you are not actually compiling what you think you are compiling. Try using "re-build all".
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #36
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    "c:\users\william\documents\visual studio 2008\projects\bankaccount.h\bankaccount.h\testbank account.cpp"

    If the above the path to your file?

    If yes, I would strongly suggest removing space in "testbank account.cpp" and not naming a folder the same as a header file!

    Tim S.
    Last edited by stahta01; 03-27-2013 at 09:45 PM.
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 10-29-2012, 03:33 AM
  2. Error C2109 + C2228
    By deeisenberg in forum C Programming
    Replies: 8
    Last Post: 04-23-2012, 11:04 AM
  3. Replies: 4
    Last Post: 07-24-2011, 09:38 PM
  4. Replies: 3
    Last Post: 10-02-2007, 09:12 PM
  5. Compiler error c2228
    By <showMe> in forum C++ Programming
    Replies: 2
    Last Post: 06-28-2006, 08:31 PM