LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-11-2012, 07:31 AM   #1
antwan100
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
Objective C Help


X code keeps giving me an error saying iostream not found. What's the problem??



#import <Foundation/Foundation.h>
#include <iostream>
#include <conio>
class time
{
int hr,min,sec;
public:
time()
{
hr=min=sec=0;
cout<<"
Time reset to 00:00:00";
}
time(int h,int m,int s)
{
hr =h;
min=m;
sec=s;
cout<<"
Time set to specified value.";
}
void display()
{
cout<<"
Time set is # "<<hr<<":"<<min<<":"<<sec;
}
void add(time t1,time t2)
{
sec = t1.sec + t2.sec;
if (sec > 59)
{sec -=60; min++;}
min += t1.min +t2.min;
if(min>59)
{min-=60; hr++;}
hr += t1.hr + t2.hr;
}
};
void main()
{
clrscr();
time a(12,11,33);
time b(10,34,50);
time c;
a.display();
b.display();
c.add(a,b);
c.display();
getch();
}
 
Old 10-12-2012, 12:45 AM   #2
John VV
Guru
 
Registered: Aug 2005
Posts: 12,811

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
there is NO way we could even try to help unless YOU provide the REQUIRED information

the very basic information is missing
things like

YOUR operation system ?
the version of said OS ?
the version of gcc ( if installed) ?
and whether or not the obj compiler is installed ?
the development librarys ?? -- are they installed??

a wild guess
install the development tools and headers for your OS
"libstdc"
 
Old 10-12-2012, 01:08 AM   #3
Elv13
Member
 
Registered: Apr 2006
Location: Montreal,Quebec
Distribution: Gentoo
Posts: 825

Rep: Reputation: 128Reputation: 128
Hi, welcome to LQ

Xcode is for Mac OSX only, so I guess you are not using Linux. If that's the case, then this is the wrong forum to ask that kind of question. Very few peoples around here use OSX. It might be a better idea to ask this on a MacOSX forum.

Looking at your code, this is closer to C/C++ than OBJC. So you would be better to use Objective C++ or C++ directly than trying to do that in OBJc. This might actually be your problem in the first place. OBJc is compatible with C, iostream is from C++. The C equivalent is stdio.h
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Objective C fahad.anwar Linux - Newbie 1 08-10-2012 06:42 AM
Objective-c amboxer21 Programming 3 08-02-2012 03:19 AM
Objective C vbx_wx Programming 1 12-25-2010 09:53 PM
How to compile Objective-C? MTK358 Programming 3 12-31-2009 07:36 PM
Objective-C dogn00dles Programming 2 11-29-2003 02:30 AM


All times are GMT -5. The time now is 01:32 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration