LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-12-2005, 01:59 PM   #1
The Many
LQ Newbie
 
Registered: Feb 2005
Posts: 2

Rep: Reputation: 0
Mandrake 9.1 & fstream..


Hi...

I have compiled a program on an earlier version of Mandrake.. and it all works fine.

However, when I port the program to Mandrake 9.1, the compiler cannot compile the code that uses the fstream class. I.e. it cannot find the include files for it.

On the previous version of Mandrake there was a Gcc++ (i think) directory that held the fstream include, which does not seem to be present under Mandrake 9.1.

Does anyone have any idea how I can get this code to compile?

Or is there another class I can use instead of fstream, to get output to a file?

Thanks in advance!
 
Old 02-12-2005, 08:14 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"However, when I port the program to Mandrake 9.1, the compiler cannot compile the code that uses the fstream class. I.e. it cannot find the include files for it."

Could you post the error messages that the compiler gives you?

----------------------------------
Steve Stites
 
Old 02-13-2005, 04:42 AM   #3
The Many
LQ Newbie
 
Registered: Feb 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Sorry the comp I was using was at work...

From what I recall, I was using a ofstream to define a file to write to.. and the error message was something like.... "ofstream used as a type, but not defined as a type".... hence I assumed that it could not find the relevant include file.

The I searched /usr/include for fstream include file.. but on Mandrake 9.1 it was not present, where as on the previous version of Linux it was in a gcc+ directory.
 
Old 02-13-2005, 10:02 AM   #4
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
Posting a bit of code would help too. Were you using <fstream> or <fstream.h>? You should be using <fstream> as <fstream.h> is deprecated. You also need to be aware that <fstream> puts everything into the std namespace, so you should use something like a "using namespace std;" line, or reference ofstream as std::ofstream.

Other possibilities are that you are using gcc to compile instead of g++. g++ is the GNU C++ compiler, gcc is the GNU C compiler.

Also, make sure you have all the necessary gcc/g++ packages installed.

Last edited by deiussum; 02-13-2005 at 10:13 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
weird fstream output schneidz Programming 3 09-06-2005 03:48 PM
c++ fstream:: question javakid Programming 2 01-21-2005 01:03 PM
fstream File creaction problem... chewysplace Programming 6 01-30-2004 12:39 PM
Standard C++ fstream question GtkUser Programming 5 04-12-2003 11:45 PM
ios, iostream, fstream & iomanip etc. lsropia Programming 3 03-21-2003 01:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration