errors in class(urgent )

This is a discussion on errors in class(urgent ) within the C++ Programming forums, part of the General Programming Boards category; i do not understand the meaning of the 2 errors that im getting. PLEASE clearly tell me how i can ...

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

    errors in class(urgent )

    i do not understand the meaning of the 2 errors that im getting. PLEASE clearly tell me how i can correct those errors. below is the .h file and the errors. attached is the .cpp file.
    THANXXXXXXX




    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <iostream.h>
    #include <fstream>
    //#define Number N,n
    //#define Fruit F,f
    //#define Animal A,a
    //#define Exit X,x

    char set;

    class dice
    {
    int N,n;
    char A,a;
    char F,f;
    char X,x;

    public:
    dice(int, char, char, char);
    void operation (int,char, char, char,char);
    void num ();
    void frt ();
    void ani ();
    void ex ();
    };













    --------------------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)
    Attached Files Attached Files

  2. #2
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    I can answer that second error with out even looking at the .cpp file.

    Lets say you have code like this:

    void bob ( const char h );

    char *bob = "hello";
    myfunc(bob[3]);

    that would not work. bob[3] is a char, not a const char.
    you would have to do this:

    myfunc( const char(bob[3]) );

    so to fix that error, typecast the variable to a const char.
    My Website

    "Circular logic is good because it is."

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, 04:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 11:50 AM
  3. Winsock compilation errors
    By jmd15 in forum Networking/Device Communication
    Replies: 2
    Last Post: 08-03-2005, 09: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: 2
    Last Post: 11-10-2001, 06:51 PM

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