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

  • Home
  • SEARCH
  • 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 6974665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:16:03+00:00 2026-05-27T17:16:03+00:00

I #include these headers: #include <iostream> #include <fstream> but however this piece of code:

  • 0

I #include these headers:

#include <iostream>
#include <fstream>

but however this piece of code:

ifstream inFile;

still wont compile. what could be the problem? Im using Visual Studio 2010, Win32 C++.

  • 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-27T17:16:04+00:00Added an answer on May 27, 2026 at 5:16 pm

    You can put a using namespace std; at the top of your code so you don’t have to fully qualify standard C++ stuff, but it’s considered bad form by a large number of developers.

    I simply prefix the standard stuff with std::, which makes the code longer:

    std::cout << "Hello, world.\n";
    

    but keeps me out of trouble vis-a-vis namespace clashes.

    The following transcript shows the use of std:: prefixes in action:

    $ cat testprog.cpp
        #include <iostream>
        #include <fstream>
    
        int main (void) {
            int n;
            std::ifstream inFile("input.txt");
            inFile >> n;
            std::cout << "File contained " << n << '\n';
            return 0;
        }
    
    $ cat input.txt
    42
    
    $ g++ -Wall -Wextra -o testprog testprog.cpp ; ./testprog
    File contained 42
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Record Constructor looks like this: #include Record.h //both these headers #include <iostream> #include
I have this code which will include template.php file from inside each of these
I have these C++ headers #include <iostream> #include istruttore.h #define max 30 using namespace
These days web addresses can also include non-ASCII characters. So every modern browser and
Whenever I include boost in my project I get a million of these warnings.
When i call window.open, I can include a list of parameters. One of these
I'm having trouble including standard header files like iostream.h and fstream.h . On my
Take this code, for example: /* * foo.h * * Created on: Nov 5,
There's nothing fancy going on in this program, but I get garbage output. Here
I'm trying to test C code with googletest but I'm having some problems when

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.