|
-
June 15th, 2003, 03:10 PM
#1
Junior Member
another C++ compiler situation
I just got DEv- C++ compiler from a cd contained in a book I just bought. I can't get it to compile anything!! I write the program:
#include <iostream.h>
int main()
{
cout<<"Hello world";
}
return 0;
Then I compile(which by the way, do I have to save in a certain location?) and i click on the icon which is just for the source code, not the exe file. Then if i click run, it says the source is not compiled. Anyone have suggestions?
-0ri0n
With what weapons World War Three will be fought, I do not know, but World War Four will be fought with sticks and stones.
-Albert Einstein
-
June 15th, 2003, 03:11 PM
#2
Add a "cin >> " statement, the window closes at the end of every program, you need something to keep it open and the "cin >>" statement should do it.
The "return" statement should also be in the "int main()", additionally, are you hitting run after it says that the source has been compiled?
-
June 15th, 2003, 03:15 PM
#3
If you do not specify a location to which the compiled code must be saved it get saved into the default location.
With borland it is somewhere deep inside the 'program files' but I don't know for your compiler.
You must have givin it a name so do a search for the program.
Like 'dir /s hello.exe'. (use the name you gave the proggie).
-
June 15th, 2003, 03:17 PM
#4
noODle, no I have Dev and you don't need to specify anything, everything is done for you... it has a GUI... you ought to try it.
-
July 1st, 2003, 06:02 PM
#5
Member
The same thing happened to me... i think the one in the book is defective... i just downloaded another one from www.bloodshed.net/ but if you really want to keep that one all you have to do is modify the sample apps that come with the cd.
You laugh because im different, i laugh because your all the same.
-
July 1st, 2003, 06:24 PM
#6
when you return a value, you must be inside a function?
when you type "return 0;" that is the value you are returning for "int main()"
Code:
#include <iostream.h>
int main()
{
cout<<"Hello world";
return 0;
}
yeah, I\'m gonna need that by friday...

-
July 3rd, 2003, 09:16 PM
#7
yeah tampabay was right, you must have a main() function and your return 0; has to be inside of main() Also, you shouldnt use #include <iostream.h> That is bad programming style because it is so old. If your using a very old compiler that is ok, but hopefully you are not. Instead use:
#include <iostream>
using namespace std;
This is better style.
Also i would suggest that you read the little book that teachs you how to use your compiler...i think it will answer a lot of your questions
Support your right to arm bears.

^^This was the first video game which i played on an old win3.1 box
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|