namespace std is showing as nonexistent

This is a discussion on namespace std is showing as nonexistent within the C++ Programming forums, part of the General Programming Boards category; on my VC5.0. Why must this be? Is VC5.0 not good for win2k? //DrinkOfTheDay.cpp #include "DrinkOfTheDay.h" #include <fstream.h> using namespace ...

  1. #1
    edwardtisdale
    Guest

    namespace std is showing as nonexistent

    on my VC5.0. Why must this be? Is VC5.0 not good for win2k?


    //DrinkOfTheDay.cpp

    #include "DrinkOfTheDay.h"
    #include <fstream.h>
    using namespace std;//E:\MyITProjects\CandCPP\DrinkOfTheDay\DrinkOfTheDa y.cpp//(14) : error C2653: 'std' : is not a class or namespace name


    DrinkOfTheDay:rinkOfTheDay()
    {
    Drink=new Monday;
    }
    DrinkOfTheDay:rinkOfTheDay(Monday* Drink)
    {
    // read from file named data.dat
    ifstream from ("data.dat");
    if (!from) error("cannot open input file*, "data.dat");


    }
    void error(const char* p, const char* p2 = "")
    {
    cerr << p << ' ' << p2 << '\n";
    exit(1);
    }




    www.edwardtisdale.com

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >#include <fstream.h>
    Change this to #include <fstream>

    Namespaces didn't exist in old C++ so you have to omit the .h at the end of new C++ header files.

    -Prelude
    My best code is written with the delete key.

  3. #3
    edwardtisdale
    Guest

    same

    <cstdio>

    namespace std {
    #include <stdio.h>
    };

    Include the standard header <cstdio> to effectively include the standard header <stdio.h> within the std namespace.

  4. #4
    edwardtisdale
    Guest

    same

    guess the cstdio is only for <stdio.h> within the std namespace.

    Thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thoughts about using namespace std?
    By dwks in forum C++ Programming
    Replies: 40
    Last Post: 09-25-2008, 05:14 PM
  2. using more then one namespace? std and system? for a console app
    By fingerlickin in forum C++ Programming
    Replies: 7
    Last Post: 08-10-2005, 11:08 AM
  3. need ; before using namespace std
    By wwfarch in forum C++ Programming
    Replies: 7
    Last Post: 05-11-2004, 10:42 PM
  4. using namespace std, What does it do?
    By Ben K. in forum C++ Programming
    Replies: 1
    Last Post: 10-14-2001, 10:42 PM
  5. What is "using namespace std; "
    By Engel32 in forum C++ Programming
    Replies: 3
    Last Post: 09-28-2001, 07:23 AM

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