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

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

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 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 on other sites
Quote:
 Original post by SirSmokeycout is in the std namespace. you need to resolve which namespace cout is in.There are 2 ways to do this1. after your include statements you can use:using namespace std;this will allow you to use anything in the std namespace.or2. prefix cout with std like:std::coutthis 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)

Share on other sites
std:: cout<<
but it still does the same thing.

Share on other sites
no spaces in there
"std::cout"

Share on other sites
Quote:
 Original post by SirSmokeyno spaces in there"std::cout"
Actually, it should parse correctly either way.

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.