Computing.Net > Forums > Programming > Dev C++ help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Dev C++ help

Reply to Message Icon

Name: goaliemike
Date: February 24, 2005 at 18:47:42 Pacific
OS: xp pro
CPU/Ram: 512 ddr amd xp 2000+
Comment:

Hey i have dev c++ and in just the simplest app i got problems. my app is a basic one from a book, open a window and display the classic "hello world". now it has a file it needs calles iostream.h in dev c++ is it io.h or iostream (its a url protocol). Secondly i tried both of them and the compiler givves out that "cout" is undecleared. here is the simple app

#include <iostream>

int main()
{
cout <<"Hello World!\n";
return 0;
}

or there is the second one

#include <io.h>

int main()
{
cout <<"Hello World!\n";
return 0;
}

i get the same error in both. even java with forte for java 4 was a bit diffrent but its ok now

Im only 14, so dont blame me

AMD athlon xp 2000+
ECS K7S5A Pro
512 MB DDR ram
Sapphire atlantis 9200se
8 GB quantum fireball
30 GB Maxtor Diamondmax 60 GB Maxtor Diamondmax



Sponsored Link
Ads by Google

Response Number 1
Name: Fozzie
Date: February 24, 2005 at 19:23:06 Pacific
Reply:

Sounds like it's not finding your iostream.h file. Look in the compiler options under the directories tab and there you can tell it which directory to search for include files when compiling.

If you don't know which directory that is, use your Windows find tool to search for "iostream.h" I would just tell you which directory it is in but I use Dev C++ with Borland C++ builder so my include directory will be different than yours.


0

Response Number 2
Name: egkenny
Date: February 24, 2005 at 19:29:01 Pacific
Reply:

I don't know about dev c++ but the standard way to do it is this:

#include <iostream.h>
int main()
{
cout <<"Hello World!" << endl;
return 0;
}

The new way with namespaces has two variations:

Variation 1:

#include <iostream>
using namespace std;

int main()
{
cout <<"Hello World!" << endl;
return 0;
}

Variation 2:

#include <iostream>

int main()
{
std::cout <<"Hello World!" << std::endl;
return 0;
}


0

Response Number 3
Name: anonproxy
Date: February 24, 2005 at 22:16:13 Pacific
Reply:

add using namespace std below the #include directive or append each cout with std::cout. Alternatively, you could also declare using std::cout after the include. That's three different ways to do a similar thing, but each one operates on a different scope of classes.

using namespace std
(declares all classes in std)
using std::cout
(explicity declares cout in all instances)
std::cout
(explicitly declares class cout in one instance)

Declaring the namespace makes iostream declarations accessible.

iostream.h is the ANSI C++ standard file, but the file extension (.h, for header) was deprecated. io.h is an OS library (not necessarily standard at all).

Be sure to check the compiler's include path, per Fozzie's suggestion.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Dev C++ help

dev-c++ help color text www.computing.net/answers/programming/devc-help-color-text/7783.html

Simple C Help!!! www.computing.net/answers/programming/simple-c-help/9795.html

C++ help www.computing.net/answers/programming/c-help/3099.html