Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7500549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:13:27+00:00 2026-05-29T20:13:27+00:00

So I split my files into a few pieces and now i’m getting a

  • 0

So I split my files into a few pieces and now i’m getting a bunch of type errors. Such as:

phoneNUmber.h 'istream does not name a type'

What’s this mean exactly? Here’s my files they’re pretty short.

Main

#include <iostream>
#include <fstream>
#include <string>
#include "phoneEntry.h"
using namespace std;

int main()
{   
    PhoneEntry entry;
    ifstream filezilla;
    filezilla.open("phone.txt");

    if(filezilla)
    {
        while(!filezilla.eof() && entry.readEntry(cin))
        {
            entry.writeEntry(cout);
        }
    }
    else
    {
        cout << "Four Oh Four - File Not Found" << endl;
    }

    return 0;
}

Phone Entry

#include "phoneNumber.h"

class PhoneEntry
{
    private: 
        PhoneNumber phone;
        string firstName,
               lastName;
        void _writeDots(ostream& fout, int n) const;
    public:
        istream& readEntry(istream&);
        ostream& writeEntry(ostream&) const;

};

istream& PhoneEntry::readEntry(istream& Sin)                    
{
    Sin >> firstName >> lastName;
    phone.readNumber(Sin);

    return Sin;
};

ostream& PhoneEntry::writeEntry(ostream& Sout) const            
{   
    const int num = 28;
    int fill = num - ((firstName + lastName).length());

    Sout << firstName << ", " << lastName;

    _writeDots(Sout, fill);
    phone.writeNumber(Sout);

    return Sout;
};

void PhoneEntry::_writeDots(ostream& fout, int n) const
{
    if(n % 2)
    {
        fout << ".";
    }

    for(int i = 0; i < n; i++)
    {
        fout << " .";
    }
};

PhoneNumber

class PhoneNumber
{
    private: 
        int areaCode, 
            prefix, 
            suffix;
    public: 
        istream& readNumber(istream&);
        ostream& writeNumber(ostream&) const;
};

istream& PhoneNumber::readNumber(istream& Sin)                  
{
    Sin >> areaCode >> prefix >> suffix;
    return Sin;
};

ostream& PhoneNumber::writeNumber(ostream& Sout) const          
{
    Sout << " " << areaCode << "-" << prefix << "-" << suffix << endl;
    return Sout;
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T20:13:29+00:00Added an answer on May 29, 2026 at 8:13 pm

    What’s this mean exactly?

    It means that the compiler thinks ifstream is a variable name, with no associated type. It thinks this, because it hasn’t been given the class definition for ifstream due to you missing the proper include files:

    #include <iostream>
    #include <fstream>
    #include <string>
    

    Additionally, in PhoneEntry.cpp and PhoneNumber.cpp

    everyplace you have a istream it should be std::istream

    Same with ostream and ifstream etc.

    In your main.cpp you have the following statement using namespace std; which imports the std namespace into the global namespace, thus inside that file, you don’t have to prepend the namespace std:: to all the iostream calls.

    Since you split things out, each new cpp file no longer has the std:: in it’s global namespace, thus you have to do it yourself.

    You could add using namespace std; inside your cpp files, but I usually don’t.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is similar question with few differences : Split XML file into multiple files
I'm using the split linux command to split huge xml files into node-sized ones.
I'm trying to split an app.config file into multiple files to make it easier
I want to split a file containg HTTP response into two files: one containing
How would I split a HTML formatted file into several HTML files (complete with
does anyone know of a way to split all classes in one solution into
I need to split an flv file into chunks of the known size on
I want to split up the jQuery .js file into two, but I have
In C# I need to split a string (a log4j log file) into array
I've come across several sources stating to split up a WiX installation file into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.