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 8096691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:31:51+00:00 2026-06-05T21:31:51+00:00

I have a large program that is working other then one .h file that

  • 0

I have a large program that is working other then one .h file that gives me the error that I have “invalid use of undefined type” when I try to declare a private ofstream. In eclipse I also get the error about “declaration of struct std::ofstream” with an external ocation /user/include/c++/4.1.2/iosfwd (I cheked, that is the line/location that defines ofstream). I’ve included both iostreams and fstreams.

if I try to chage the declaration to use an ifstream or an fstream I will get the same errors, only now I’ll have an error on the declaration of whatever object type I tried to use.

To make things even more annoying I use fstream and ifstreams elsewhere in the program. At one point I got exasperated enough that I copy the full contents of a valid .h file using an ifstream into the .h file that gave me an error…and I got the same error. I don’t know why code valid in one file would be invalid in another file when the only change is the name of the file and the if_def macros. The two .h files reside in the same directory.

I’m sorry I can’t post the code to be reviewed. It’s written on a different computer with no way to transfer the code from computer A to B (and no internet access). But if you can provide a suggestion as to why I would get this error for me to test without viewing the code I would appreciate it.

EDIT: After playing around some more I learn if I remove the .H file from it’s CPP file error goes away. so if the file is named VectorOutput.h. if I remove the #include from VectorOutput.cpp, even if I include it in other files, eclipse doesn’t complain. If I change the name of VectorOutput.cpp in any way the error goes away too. Which is…bizzare. I have no clue what that could mean, the name and specific location of the files should mean nothing as far as I know. by renaming the file I sort of got rid of the issue for now, but I really awnt to know he underlying cause if anyone has a guess.

  • 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-06-05T21:31:52+00:00Added an answer on June 5, 2026 at 9:31 pm

    You provide little to go on. I would check your namespaces. Check that you are declaring your type correctly with the prefix std::.

    EDIT:
    Actually, if you are using the ofstream in your header (and you are since you are declaring it a member), you will have to include the fstream header. iosfwd is only good for forward declaring the types.

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

Sidebar

Related Questions

I have a large text file. Each time my program runs, it needs to
working on making a flash program that loads about 1000 jpegs and then plays
I am working on a C# console program that grabs large numbers of records
I'm working on a simulation program that draws points and other primitives on top
I have written a fairly large program in Fortran 90. It has been working
I'm working with a large library of files, and have one .cpp to compile.
I have a program that is very large scale (tens of thousands of lines
I am working on a C# program that reads in very large files and
I have a very large program which I have been compiling under visual studio
I have a large Prolog program with lots of predicates. I need to connect

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.