Thread: errors in class(urgent)

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    11

    errors in class(urgent)

    im attaching my .cpp code file with errors. PLEASE tell me what these errors mean. there are only 2 errors in the code actually.....PLEASE help me correct those errors and ALSO, do i need to add void main() to end the program?
    THANK U......VERY MUCH.

    --------------------Configuration: dice - Win32 Debug--------------------
    Compiling...
    dice.cpp
    C:\My Documents\Ayesha Karim\dice.cpp(28) : error C2064: term does not evaluate to a function
    C:\My Documents\Ayesha Karim\dice.cpp(29) : error C2064: term does not evaluate to a function
    C:\My Documents\Ayesha Karim\dice.cpp(30) : error C2064: term does not evaluate to a function
    C:\My Documents\Ayesha Karim\dice.cpp(31) : error C2064: term does not evaluate to a function
    C:\My Documents\Ayesha Karim\dice.cpp(32) : error C2064: term does not evaluate to a function
    C:\My Documents\Ayesha Karim\dice.cpp(57) : error C2440: '=' : cannot convert from 'char [6]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(58) : error C2440: '=' : cannot convert from 'char [7]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(59) : error C2440: '=' : cannot convert from 'char [7]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(60) : error C2440: '=' : cannot convert from 'char [7]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(61) : error C2440: '=' : cannot convert from 'char [6]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(62) : error C2440: '=' : cannot convert from 'char [11]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(76) : error C2440: '=' : cannot convert from 'char [4]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(77) : error C2440: '=' : cannot convert from 'char [4]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(78) : error C2440: '=' : cannot convert from 'char [5]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(79) : error C2440: '=' : cannot convert from 'char [6]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(80) : error C2440: '=' : cannot convert from 'char [7]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    C:\My Documents\Ayesha Karim\dice.cpp(81) : error C2440: '=' : cannot convert from 'char [7]' to 'const char'
    This conversion requires a reinterpret_cast, a C-style cast or function-style cast
    Error executing cl.exe.

    dice.obj - 17 error(s), 0 warning(s)

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    28

    What about the .h file??

    When I ran the program it said i needed the .h file which you haven't oploaded.
    ...

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    30
    The ones that say "cannot convert" blah blah blah are occuring because you are trying to make a constant, the character 's' in this case equal a string of constants. This doesn't make much sense. First of all you should have a string, not just a single character for the variable string...you could have:

    char *string;

    or

    char string[MAX_STRING_LEN];

    where MAX_STRING_LEN is some integer value. Seconds, instead of setting 's' equal to apple, bannana, etc., set string equal to it, but you need to use something like strcpy(), strcat() or a manual copy of each character. Look up strcpy(). Not sure about the first error, unless you didn't define those functions in your class definition, include your header files next time so I can see the class please. ty

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  3. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 08:00 AM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. errors in class(urgent )
    By ayesha in forum C++ Programming
    Replies: 1
    Last Post: 11-10-2001, 10:14 PM