Class Specification /Implementation file
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Class Specification /Implementation file

  1. #1
    Join Date
    Oct 2013
    Posts
    1

    Exclamation Class Specification /Implementation file

    I keep getting this error

    In file included from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/ios_base.h:43:0,
    from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/ios:43,
    from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/ostream:40,
    from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/iostream:40,
    from player1.cpp:3:
    /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/locale_classes.h:45:1: error: expected unqualified-id before ‘namespace’

    What does it mean?
    I am working on classes and this error comes when I run the implentation of my class file.

    //Implimentation of class player1 (player.cpp)
    #include "player1.h"
    #include <iostream>
    //using namespace std;

    void player1 :: Set_Name()
    //Pre: none
    //Post: User has input first and last name
    {
    std::cout << "Enter your first and last name seperated by a space. Respectively?\n";
    std::cin >> first_name >> last_name;
    }

    string player1 :: Get_FName()
    //Pre: string first_name has been updated in Set_Name
    //Post: first name will be returned
    {
    return first_name;
    }

    string player1 :: Get_LName()
    //Pre: string last_name has been updated in Set_Name
    //Post: last naem will be returned
    {
    return last_name;
    }

    void player1 :: Set_School()
    //Pre: none
    //Post: school_name has been updated
    {
    std::cout << "Enter your school name and then press enter.\n";
    std::cin >> school_name;
    }

    string player1 :: Get_School()
    //Pre: school_name was updated
    //Post: school is returned
    {
    return school_name;
    }

    void player1 :: Set_Team()
    //Pre: none
    //Post: team_name, league, and position will be updated
    {
    std::cout << "Which leaugue are you a player for?\n1)NBA\n2)***\n Press 1 for NBA or 2 for ***.\n";
    std::cin >> leauge;
    switch (leauge) {
    case 1: league_choice = "NBA";
    std::cout << "Enter what NBA team you play for in the following format:\nBoston Celtics, input Celtic\n";
    std::cin >> team_name;
    std::cout << "Enter what postion you play in the following format:\nShooting Guard, input SG\n";
    std::cin << position;
    break;
    case 2: league_choice = "***";
    std::cout << "Enter what *** team you play for in the follwoing format:\n Buffalo Bills, input Bills\n";
    std::cin >> team_name;
    std::cout << "Enter what position you play in the follwoing format:\nFull Back, input FB\n";
    ;
    std::cin >> positon;
    break;
    }
    }

    string player1 :: Get_Team()
    //Pre: team_name has been updated
    //Post: team is returned
    {
    return team_name;
    }

    string player1 :: Get_Position()
    //Pre: position has been updated
    //Post: position is returned
    {
    return position;
    }

  2. #2
    Join Date
    Apr 1999
    Posts
    27,446

    Re: Class Specification /Implementation file

    Quote Originally Posted by kassandratb View Post
    I keep getting this error

    In file included from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/bits/ios_base.h:43:0,
    from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/ios:43,
    from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/ostream:40,
    from /usr/lib/gcc/i686-redhat-linux/4.5.1/../../../../include/c++/4.5.1/iostream:40,
    from player1.cpp:3:
    1) This forum is for Visual C++, not gcc running under Linux. Post in the Non-Visual C++ forum instead of this one.

    2) When posting code, use code tags. What you posted is practically unreadable.

    Regards,

    Paul McKenzie

  3. #3
    Join Date
    Jul 2002
    Posts
    2,526

    Re: Class Specification /Implementation file

    Looks like the problem is in player1.h file.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center