Thanx for everyone's reply. I'm more and more being put off Java, although it looks like a good language in practise, the way it looks as a GUI doesn't appeal. Anyone know of a good free C++ IDE ? I have tried Devc++ from bloodshed, but it wont let me compile for some reason.

You may move this thread to C++ if you wish to keep things tidy :)

Thanks In Advance,
Matt

Sorry - looks like I pressed wrong button, I ment reply not new topic!

I apologise.

What error are you getting when you try to compile in Dev-C++? It's always worked fine for me.

[Warning] In function 'int main()'

'cout' undeclared (first use this function}


And here is the code I am using to build Hi World proggy, testing Dev cpp :

#include <windows.h>
using namespace std;
int main()
{
cout << "Hello World From About\n";
}

I think the header maybe iostream , but when I try this I get about 150 (not kidding) errors, reporting on lines that excede the amount used ( 6 ).

Anyone help ?

When you have int main() it means that the function main() is returning a value of type int (an integer). Right after your cout statement you have to add a return (0); statement.

And yes, use iostream.h ... Sometimes Windows likes #include<iostream> instead of iostream.h though!

It now says iostream not found and when iostream.h is tried, the same result.

Really? Hmm... what version of Dev-C++ are you using? The following works for me on Dev-C++ 4.0:

#include <iostream.h>

int main&#40;&#41; &#123; 
  cout << "Hello World From About\n";
  return 0;
&#125;

The latest version of dev-cpp doesn't recognise <iostream.h>, you need to use the standard version of the same header - <iostream>. When you do, you need to qualify any entities from namespace std.

Here are two versions that do that, and should compile and run OK. If they don't, post back with your error messages.

#include <iostream>
using namespace std;
int main&#40;&#41;
&#123;
cout << "hello, world" << endl;
cin.get&#40;&#41;;
&#125;

or this:

#include <iostream>
int main&#40;&#41;
&#123;
std&#58;&#58;cout << "hello, world" << std&#58;&#58;endl;
std&#58;&#58;cin.get&#40;&#41;;
&#125;

Two things to note:

[1] The return statement is optional in main() (though some older compilers will complain)

[2] I added the cin.get() to stop your console window from disappearing before you've seen the output.

One more thing, there was an installation problem with a recent version of dev-cpp - it missed a path from the compiler options (which leads to hundreds of error message when you try to compile pretty much anything at all).

Go to:

Tools ~ Compiler Options ~ Directories ~ C++ Includes and check that it lists the paths for:

..\include
..\include\c++
..\include\c++\mingw32

It's the last one that you may have missing, if so, add it.

And don't be put off, there's really very little wrong with dev-cpp and I'm sure you'll get a lot of pleasure out of using it. Good value for money IMHO.

What do you mean by the latest version? The beta version? 5? I'm using 4 and the code I posted with "<iostream.h>" works and has always worked for me.

I'm downloading updates as I type... will post with result after!

Nope :

The top line of

#include <iostream>
using namespace std;
int main()
{
cout << "hello, world" << endl;
cin.get();
}


is made all red and a load of errors appear like :
C:\Dev-Cpp\include\c++\iostream:44
bits/c++config.h: No such file or directory.


According to dev cpp, i'm using version 4.9.7.8 .

Any help will be appreciated, and I know this is a great program and I wanna use it :)

Have you checked the compiler options that I wrote about?

I am missing the last one, I was hoping the update may fix this. Any other ideas? I do have a copy of Metrowerks Codewarrior 5, but it's slightly different.

Just add the last path to your compiler options and it should compile OK. The dev-cpp directory will be the same as for the others.

You star :P It's all working and hoo.exe ran :D but the window closed before I could see hello world :(.
Any line of code i should add to get a 'press any button to continue'?

Thank you ever so much, I am really looking forward to programming in C++ now, my first compiled language :D

#include <iostream> 
using namespace std; 
int main&#40;&#41; 
&#123; 
cout << "Hello World From About\n"; 
return &#40;0&#41;; 
&#125;

The answer is in the previous posts. Dev-c++ will close the console window as soon as the program terminates, so all you have to do is out in a command that stops it from terminating until you're ready. Simplest is just:

cin.get();

This will wait for you to press enter. In some instances you may want to add the following:

cin.ignore(1000,'\n');
cin.get();

Good luck!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.