New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

g++ fstream in Mac OS X 10.6


Post Reply New Thread Subscribe

 
Thread Tools
adamyang

 
Member Since: Feb 20, 2011
Posts: 1
adamyang is on a distinguished road

adamyang is offline
Hello,

I'm using Mac OS X 10.6 and installed Xcode 3.X. I'm actually working on a C++ project and try to use g++ to build the project.

I include ifstream but it prompted an error that 'can't find file or directory' ifstream somehow. I thought stdio exist somewhere that include <iostream> works.

Is there any one can help me out?

Adam
Thank you
QUOTE Thanks
tehmorp

 
Member Since: May 10, 2012
Posts: 3
tehmorp is on a distinguished road

tehmorp is offline
I have the same problem with xcode 3.1.4 on Os X 10.5. No idea how to solve it. I've been trying to figure out if it's possible to have a compiler installed, but not have The C Language installed?
QUOTE Thanks
vansmith

 
vansmith's Avatar
 
Member Since: Oct 19, 2008
Location: Toronto
Posts: 18,235
vansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond reputevansmith has a reputation beyond repute
Mac Specs: 2012 13" MBP (2.5 i5, 8GB)

vansmith is online now
The language support is handled by the compiler. However, the header files are separate but should be included. You can check to see if it's there by looking in /usr/include/c++/<gcc version number>.

Important Links: Community Guidelines : Use the reputation system if you've been helped.
M-F Blog :: Write for the blog
Writing a Quality Post
QUOTE Thanks
tehmorp

 
Member Since: May 10, 2012
Posts: 3
tehmorp is on a distinguished road

tehmorp is offline
Thanks for the reply. That folder exists, and there are a number of things there, such as "string" and "iostream" (both ASCII C++ program text), but, e.g., there is no ifstream file.

I checked a working installation of g++ on a Linux machine, and it has roughly the same files in the corresponding folder (i.e., no ifstream), yet it allows me to #include<ifstream>. I located, and no file called ifstream seems to exist on that Linux system, so I assume this header file must be located inside another file.

#include<string>, #include<iostream> both work on my system, so the compiler seems to know where some things are, yet #include<ifstream> still does not work. I feel like there must be something extremely basic I don't know (not an unreasonable supposition, since I'm a beginner), and my googling has been no help at all (probably because I'm using the wrong search terms and I can't think of better ones). Is there some sort of path I could be setting?
QUOTE Thanks
tehmorp

 
Member Since: May 10, 2012
Posts: 3
tehmorp is on a distinguished road

tehmorp is offline
Okay, apparently ifstream and ofstream are both contained inside fstream. So when I include fstream, rather than *ifstream*, I am now able to create a variable of type ifstream. I don't know how to do anything with it yet, so that's as far as I've gotten, but no compile errors at least....

Thanks for the help!
QUOTE Thanks

Post Reply New Thread Subscribe


« how do get started in java | Calendar interface for cocoa app »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Who's got the most Macs? narf1899 Schweb's Lounge 139 11-24-2012 11:53 AM

All times are GMT -4. The time now is 03:53 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?