Thread: Cant solve this error... please help...

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    ------------
    Join Date
    Jun 2005
    Posts
    79

    Cant solve this error... please help...

    Ok, i switched from coding a MUD to a regular text based game... I decided to use a structure to hold the player information, and anything that you can fight (trying to keep organised, and easier to change) but i keep getting this error:

    [montez@localhost codes]$ c++ game.cpp -o game -O2 -Wall
    game.cpp: In function `void name()':
    game.cpp:37: error: request for member `player' in `name', which is of non-class type `void ()()'

    when i try to compile it... this is my souce so far:

    Code:
    #include <iostream>
    
    using namespace std;
    
    struct stats { //declairs a structure that holds the player information
            string name; //players name
            string weapon; //players weapon
            int life; //players life
    };
    
    void intro();
    void name();
    
    void intro() {
            cout<<"--------------------------------------------- "<<endl;
            cout<<"----                                     ---- "<<endl;
            cout<<"----                                     ---- "<<endl;
            cout<<"----          -My    Game-                ---- "<<endl;
            cout<<"----                                     ---- "<<endl;
            cout<<"----                                     ---- "<<endl;
            cout<<"----          -By: Goosie-               ---- "<<endl;
            cout<<"----                                     ---- "<<endl;
            cout<<"----                                     ---- "<<endl;
            cout<<"--------------------------------------------- "<<endl;
            name();
    }
    
    int main() {
            stats player;
            player.life = 100;
    
            intro();
    }
    
    void name() {
            cout<<"Enter your name: ";
            cin>>name.player;
    }
    any help would be appreciated
    Last edited by Goosie; 07-08-2005 at 04:21 PM. Reason: removing a ton of extra spaces...
    CAUTION: Newbie at programming!
    -------------------------------------------------
    Thanks everyone who helped me with all the questions, and utter lost-ness i happen to have... it is VERY VERY much appreciated

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 04-25-2005, 11:59 AM
  2. help solve linking problem, thanks
    By Raison in forum Windows Programming
    Replies: 8
    Last Post: 05-29-2004, 11:14 AM
  3. ^^ help me solve the error
    By skwei81 in forum C++ Programming
    Replies: 2
    Last Post: 04-03-2003, 09:04 AM
  4. Help to solve this problem
    By Romashka in forum C++ Programming
    Replies: 3
    Last Post: 04-16-2002, 09:32 AM