Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

depreciated libraries

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming
View previous topic :: View next topic  
Author Message
alloydog
LXF regular


Joined: Thu Apr 07, 2005 8:32 pm
Posts: 600

PostPosted: Fri Jun 23, 2006 12:15 pm    Post subject: depreciated libraries Reply with quote

I posted this one before, ages ago, but it looks as if it has been cleared out, as the forum posts don't seem to go back that far.

Anyway, When I used Xwpe to compile Helloworld.cpp, I got a wordy warning about the library used, in this case iostream.h being depreciated.

I am using "Teach Yourself C++ in 21 Days", which is a few years old.

So, what libraries should I be using?
Back to top
View user's profile Send private message
Gordon
LXF regular


Joined: Thu Apr 07, 2005 6:01 pm
Posts: 209
Location: Bradford, West Yorkshire

PostPosted: Fri Jun 23, 2006 5:04 pm    Post subject: RE: depreciated libraries Reply with quote

This warning means that you have used the declaration
Code:

#include <iostream.h>

inside your source file but for proper C++ you neead to use
Code:

#include <iostream>

For the proper (2nd) method to work correctly you may also need to use the statement
Code:

using namespace std;

somewhere near the beginning of your code and also call the compiler with
Code:

g++ -o helloworld Helloworld.cpp


Are you using "Teach Yourself C++ in 21 days" or "Teach yourself C++ for linux in 21 days"?
_________________
Violence is the last refuge of the incompetent
Back to top
View user's profile Send private message Yahoo Messenger
alloydog
LXF regular


Joined: Thu Apr 07, 2005 8:32 pm
Posts: 600

PostPosted: Fri Jun 23, 2006 8:08 pm    Post subject: RE: depreciated libraries Reply with quote

The full warning is:
Code:
#ifdef __DEPRECATED
#warning This file includes at least one deprecated or antiquated header. \
Please consider using one of the 32 headers found in section 17.4.1.2 of the
C++ standard.  Examples include substituting the <X> heqader for the >X.h> \
header for C++ includes, or <sstream> instead of the deprecated header \
<strstream.h>  To diasble this warning use -Wno-deprecated.
#endif
I tried using just <iostream>, but I then got a different warning.
I think <iostream> has been replaced with something different.

Using <iostream.h>, the programme still compiled and ran OK.

I am using the "Teach Yourself C++ in 21 days".
Back to top
View user's profile Send private message
GMorgan
LXF regular


Joined: Thu Jan 12, 2006 6:58 pm
Posts: 684
Location: South Wales, UK

PostPosted: Sat Jun 24, 2006 2:17 am    Post subject: RE: depreciated libraries Reply with quote

iostream is the central input and output header for C++, its crucial to most C++ programs. You could use cstdio or stdio.h* but that is orignal C rather than C++. Your using Ubuntu aren't you, have you tried sudo apt-get install build-essential, it should ensure that your uptodate with the libraries.

*the original C headers used the .h notation. In C++ they dropped the .h. C++ also included original C functions repacked for C++ but with c in front of the original name. Hence stdio.h becomes cstdio, they both perform the same functions. iostream should work though and is the standard way of doing things in C++.
Back to top
View user's profile Send private message
Gordon
LXF regular


Joined: Thu Apr 07, 2005 6:01 pm
Posts: 209
Location: Bradford, West Yorkshire

PostPosted: Sun Jun 25, 2006 10:12 am    Post subject: RE: depreciated libraries Reply with quote

What warning did you get when you used the <iostream> declaration?
_________________
Violence is the last refuge of the incompetent
Back to top
View user's profile Send private message Yahoo Messenger
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast