| View previous topic :: View next topic |
| Author |
Message |
alloydog LXF regular

Joined: Thu Apr 07, 2005 8:32 pm Posts: 600
|
Posted: Fri Jun 23, 2006 12:15 pm Post subject: depreciated libraries |
|
|
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 |
|
 |
Gordon LXF regular

Joined: Thu Apr 07, 2005 6:01 pm Posts: 209 Location: Bradford, West Yorkshire
|
Posted: Fri Jun 23, 2006 5:04 pm Post subject: RE: depreciated libraries |
|
|
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 |
|
 |
alloydog LXF regular

Joined: Thu Apr 07, 2005 8:32 pm Posts: 600
|
Posted: Fri Jun 23, 2006 8:08 pm Post subject: RE: depreciated libraries |
|
|
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 |
|
 |
GMorgan LXF regular
Joined: Thu Jan 12, 2006 6:58 pm Posts: 684 Location: South Wales, UK
|
Posted: Sat Jun 24, 2006 2:17 am Post subject: RE: depreciated libraries |
|
|
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 |
|
 |
Gordon LXF regular

Joined: Thu Apr 07, 2005 6:01 pm Posts: 209 Location: Bradford, West Yorkshire
|
Posted: Sun Jun 25, 2006 10:12 am Post subject: RE: depreciated libraries |
|
|
What warning did you get when you used the <iostream> declaration? _________________ Violence is the last refuge of the incompetent |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|