Problem with headers

This is a discussion on Problem with headers within the C++ Programming forums, part of the General Programming Boards category; In the source code attached I am using both the header files <string.h> and <fstream.h> and my compiler is telling ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    15

    Problem with headers

    In the source code attached I am using both the header files <string.h> and <fstream.h> and my compiler is telling me that ifstream and ofstream are ambiguous symbols. I have located the source of the problem but need to use strings AND fstream. How can I solve this?

    -Zagaberoo
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Use these headers :
    Code:
    #include <fstream>
    #include <iostream>
    #include <string>

  3. #3
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    and don't forget:
    Code:
    using namespace std;
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    15
    Thank you, that solved my problem completely.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  2. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  3. Replies: 6
    Last Post: 04-28-2006, 12:06 PM
  4. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 05:24 PM
  5. Replies: 5
    Last Post: 11-07-2005, 10:34 PM

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