We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,578 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Warning:header. why i'm getting this?

hi guys, i'm just starting out c++.
Now the problem is, no matter whatever program i write, i'm getting this warning.

#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> header for the <X.h> \
header for C++ includes, or <iostream> instead of the deprecated header \
<iostream.h>. To disable this warning use -Wno-deprecated.

one demo code:

#include <iostream.h>
int main()
{
    char *p = "hello world";
    cout<<p;
    return 0;
}

can anyone explain pls?
thanks
P.S: i use Code::Blocks

3
Contributors
5
Replies
27 Minutes
Discussion Span
2 Years Ago
Last Updated
6
Views
Question
Answered
urbangeek
Light Poster
41 posts since Mar 2010
Reputation Points: 13
Solved Threads: 1
Skill Endorsements: 0

Examples include substituting the <X> header for the <X.h> \
header for C++ includes, or <iostream> instead of the deprecated header \
<iostream.h>.

Um..... I think your compiler has said it all... Try actually reading it.

The way you've written your code is not per the current C++ standards. There are no headers that are part of the current standard that end with ".h"...

Fbody
Posting Maven
2,929 posts since Oct 2009
Reputation Points: 833
Solved Threads: 394
Skill Endorsements: 5

Um..... I think your compiler has said it all... Try actually reading it.

The way you've written your code is not per the current C++ standards. There are no headers that are part of the current standard that end with ".h"...

thanks for your reply.
Did you mean, i should use <iostream> instead of <iostream.h>?
well...i tried that. but then i'm getting errors like "cout was not declared in this scope" or "endl was not declared in this scope"..i think in this case they can't find the header files where these functions are written.
sorry for my bad english, i'm not native english speaker.
thanks to all.

urbangeek
Light Poster
41 posts since Mar 2010
Reputation Points: 13
Solved Threads: 1
Skill Endorsements: 0

>>Did you mean, i should use <iostream> instead of <iostream.h>?
That's exactly what I/it mean(s).

>>but then i'm getting errors like "cout was not declared in this scope" or "endl was not declared in this scope"..i think in this case they can't find the header files where these functions are written
Nope. It means you didn't resolve your namespace properly. All functions and objects that are members of the standard headers are declared within the "std" namespace. To get to them, you must resolve the namespace.

Fbody
Posting Maven
2,929 posts since Oct 2009
Reputation Points: 833
Solved Threads: 394
Skill Endorsements: 5

In other words, add the line using namespace std; after your header.

WaltP
Posting Sage w/ dash of thyme
Team Colleague
11,404 posts since May 2006
Reputation Points: 3,421
Solved Threads: 1,055
Skill Endorsements: 37

thanks to all.
I'm reading a crap book..!:icon_mad:
gotta change it.

urbangeek
Light Poster
41 posts since Mar 2010
Reputation Points: 13
Solved Threads: 1
Skill Endorsements: 0
Question Answered as of 2 Years Ago by Fbody and WaltP

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0765 seconds using 2.73MB