Sign in to follow this  

Dev c++ compiling problem. (#include stddef.h)

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i have just started this, and i have a huge problem. Everything should be allright, but Dev c++ just seems not compile my first "Hello World" - program. What is the problem? Its the #include <stddef.h> line that seems to have the problem when i compile and run, and i cannot understand this! Here is a picture; http://www.geocities.com/torturecod/jees.jpg Help! Im running on Windows Vista. Thanks.

Share this post


Link to post
Share on other sites
cout is in the std namespace. you need to resolve which namespace cout is in.
There are 2 ways to do this
1. after your include statements you can use:

using namespace std;

this will allow you to use anything in the std namespace.

or
2. prefix cout with std like:
std::cout

this is the preferred method.

Edit: By the way i should let you know that Dev C++ is not supported anymore and, in my opinion, it's terrible. You should get yourself a copy of Visual Studio Express 2008 (it's free)

Share this post


Link to post
Share on other sites
Quote:
Original post by SirSmokey
cout is in the std namespace. you need to resolve which namespace cout is in.
There are 2 ways to do this
1. after your include statements you can use:

using namespace std;

this will allow you to use anything in the std namespace.

or
2. prefix cout with std like:
std::cout

this is the preferred method.

There's a third method that reaches a middle ground between the two - you won't need to prefix every cout with std::, and you don't drag the entire std:: namespace where it doesn't belong. At the tightest scope that makes since:
using std::cout;
Never use using in a header file, though, as others may become angry when they use a library you've created and are forced to use the same namespaces you are. More information can be found here, on this and many other relevant topics.
Quote:
You should get yourself a copy of Visual Studio Express 2008 (it's free)

That's all sorts of good advice -- follow it!

Share this post


Link to post
Share on other sites
The stddef.h problem has nothing to do with the namespace problem. Or at least I really doubt it does.

I highly recommend getting VC++ 2008 though, it's a lot better. Dev-C++ never was that great and now that it's abandoned, all the more reason to seek alternatives.

Share this post


Link to post
Share on other sites

This topic is 3591 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this