943,494 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 6921
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Mar 12th, 2003
0

Java

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
boohoo is offline Offline
11 posts
since Mar 2003
Mar 12th, 2003
0
Re: Java
Sorry - looks like I pressed wrong button, I ment reply not new topic!

I apologise.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
boohoo is offline Offline
11 posts
since Mar 2003
Mar 12th, 2003
0
Re: Java
What error are you getting when you try to compile in Dev-C++? It's always worked fine for me.
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002
Mar 13th, 2003
0
Re: Java
[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 ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
boohoo is offline Offline
11 posts
since Mar 2003
Mar 13th, 2003
0
Re: Java
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.
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Mar 13th, 2003
0
Re: Java
And yes, use iostream.h ... Sometimes Windows likes #include<iostream> instead of iostream.h though!
Administrator
Staff Writer
Reputation Points: 1422
Solved Threads: 162
The Queen of DaniWeb
cscgal is offline Offline
13,645 posts
since Feb 2002
Mar 13th, 2003
0
Re: Java
It now says iostream not found and when iostream.h is tried, the same result.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
boohoo is offline Offline
11 posts
since Mar 2003
Mar 13th, 2003
0
Re: Java
Really? Hmm... what version of Dev-C++ are you using? The following works for me on Dev-C++ 4.0:


C++ Syntax (Toggle Plain Text)
  1. #include <iostream.h>
  2.  
  3. int main() {
  4. cout << "Hello World From About\n";
  5. return 0;
  6. }
Team Colleague
Reputation Points: 262
Solved Threads: 18
a.k.a inscissor
samaru is offline Offline
1,227 posts
since Feb 2002
Mar 14th, 2003
0
Re: Java
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.

C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. cout << "hello, world" << endl;
  6. cin.get();
  7. }

or this:

C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. int main()
  3. {
  4. std::cout << "hello, world" << std::endl;
  5. std::cin.get();
  6. }

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.
Bob
Team Colleague
Reputation Points: 15
Solved Threads: 2
Junior Poster
Bob is offline Offline
129 posts
since Feb 2003
Mar 14th, 2003
0
Re: Java
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.
Bob
Team Colleague
Reputation Points: 15
Solved Threads: 2
Junior Poster
Bob is offline Offline
129 posts
since Feb 2003

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: question
Next Thread in C++ Forum Timeline: Games





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC