VERY basic classes not working

This is a discussion on VERY basic classes not working within the Windows Programming forums, part of the Platform Specific Boards category; I'm trying to create my own type of variable, and my compiler won't have it. I can fix the errors ...

  1. #1
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    920

    VERY basic classes not working

    I'm trying to create my own type of variable, and my compiler won't have it. I can fix the errors it gives me, but by doing so I would have to change what I'm actually DOING. What's wrong?

    --------------------Configuration: Windows - Win32 Debug--------------------
    Compiling...
    Windows.cpp

    c:\program files\microsoft visual studio\vc98\include\david.h(14) : warning C4091: 'typedef ' : ignored on left of 'class _ERROR' when no variable is declared

    c:\program files\microsoft visual studio\vc98\include\david.h(14) : error C2143: syntax error : missing ';' before 'constant'

    c:\program files\microsoft visual studio\vc98\include\david.h(14) : fatal error C1004: unexpected end of file found
    Error executing cl.exe.

    Windows.exe - 2 error(s), 1 warning(s)

    PHP Code:
    typedef  class _ERROR
    {
        
    bool NewError();
        
    char *Message;
        
    bool MessageSwitch;
        
    bool SwitchOff();
        
    bool SwitchOn();

    }
    ERROR
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    920
    Nevermind. "ERROR" is pre-defined. My bad. I'll change it to "ERR".
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    Code:
    class _ERROR
    {
        // add constructor, destructor and other functions here.
    };
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    ...and in C++ you don't need that typedef anymore. Just name your class ERROR ( or something else if it's already used ).
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 01-13-2008, 02:14 AM
  2. Working with winAPI in classes (newbie question)
    By Spyril in forum Windows Programming
    Replies: 3
    Last Post: 11-09-2007, 03:21 PM
  3. Exporting VC++ classes for use with VB
    By Helix in forum Windows Programming
    Replies: 2
    Last Post: 12-29-2003, 05:38 PM
  4. Questions on Classes
    By Weng in forum C++ Programming
    Replies: 2
    Last Post: 11-18-2003, 06:49 AM
  5. Prime Number Generator... Help !?!!
    By Halo in forum C++ Programming
    Replies: 9
    Last Post: 10-20-2003, 08:26 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21