...

View Full Version : Complier Problems



Unknown
01-25-2004, 07:09 PM
I'm using DEV-C++ compiler and whenever i try to compile this code :

#include <iostream.h>
int main()
{
cout<<"HEY, you, I'm alive! Oh, and Hello World!";
return 0;
}

the compile works but when i click on the program it shows up on my screen for .1 secs then exits.... here is one of the messages it gives me under the compile tab at the bottom of the program

2 C:\Dev-Cpp\include\c++\backward\backward_warning.h:32
#warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.

liorean
01-25-2004, 07:13 PM
Do a pause there - wait for the user to press a key or something. Or, run it from the command prompt.

Unknown
01-25-2004, 07:18 PM
Well condisering I just started C++ i dont know anything about pasuing or key... do you know why it keeps giving this error?

2 C:\Dev-Cpp\include\c++\backward\backward_warning.h:32
#warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.

I tried compiling this :

#include <iostream.h>
int
main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
return 0;
}

it worked but when i put in a number and hit enter it exited :(

Could this be becuase of the compiler's setting??!? or something i have to change?!?!

liorean
01-25-2004, 07:40 PM
Hmm, seems like
#include <instream.h> is not the correct header inclusion, use
#include <iostream>
using namespace std instead.

Unknown
01-25-2004, 07:45 PM
Nope nothing will work...Don't know why.. any compiler suggestions???!?!

liorean
01-25-2004, 07:50 PM
Does it still give you that warning? Or is it the fact it closes as soon as you have pressed the key that is the problem? That is not a problem with the program, you see, since that is how Windows handles DOS programs. When they are finished, it closes their window. If you want to keep them open after the program is finished, use the command prompt to run them in the first place.


(As for that warning, this is not a problem with the compiler, and changing to another compiler won't help. This is a problem with the code itself.)

Unknown
01-25-2004, 08:11 PM
Ok thank alot. I found out how to add the system pause :) and it worked. HEH i also changed mycompiler from DevC++ 5 Beta to version 4 :). Thanks

Mhtml
01-26-2004, 02:32 AM
To 4!!! :eek: I can't live without the extra features in 5. It's not that full of bugs really. Although I would rather if they had written it in C++ though because I don't use Delphi so their source is useless to me.

No matter, I'll make an IDE when I finish my current program this year.

Anyway, Dev-C++ is a fine compiler. Infact Dev-C++ isn't even a compiler, it's an IDE (Integrated Development Environment) which uses the MingW GCC compiler. It will work fine with other free compilers out there though.

Unknown
01-26-2004, 03:00 AM
Ya i just noteiced how ugly versoin 4 is. I'm think of reinstalling 5. That would be the 5th time i install it :)

Mhtml
01-26-2004, 03:12 AM
lol. :) :thumbsup:

Unknown
01-26-2004, 03:47 AM
Ok for some reason whenever I try adding a pause to the program it gives me errors. THis is in DEV C++ 5

C:\test.cpp
[Warning] In function `int main()':

17 C:\test.cpp
parse error before `return'

In Dev C++ 4 I opend a new file and it had some text in it. One was an include the other was system("PAUSE") I copied the include and then put the system("PAUSE") and it worked. But i forgot the include and when ever i put in the system("PAUSE") it wont work and gives me the above errors :mad: :confused:

Mhtml
01-26-2004, 03:55 AM
Ok show me your code. It's saying there is an error before the return statement.

Unknown
01-26-2004, 03:58 AM
[CODE}#include <iostream.h>

int main()
{
cout << "Hello World!\n";
system("PAUSE")
return 0;
}
[/CODE]

Unknown
01-26-2004, 03:58 AM
#include <iostream.h>

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

Mhtml
01-26-2004, 04:00 AM
Just as I suspected ;) you are missing the ; after the system command. :thumbsup:

Unknown
01-26-2004, 04:03 AM
OMG....

Stupid JavaScript

well stupid me should of know that this isn't JavaScript besides the tuto told me to put the ;

lol i'm stupid i reinstalled this program at least 5 times and i think i redownloaded it every single time......... Thanks alot now I can do stuff.

Can you delete that extra post i made? the one with no code tags?

Unknown
01-26-2004, 04:04 AM
But how come the tuto dosen't tell me to put the system("PAUSE");

liorean
01-26-2004, 04:09 AM
Because that is not a necessary part of the program. DOS programs normally return control to the shell when exiting, and since there is no DOS shell to exit to (unless you opened one) in windows, the window is closed. That is normal, though.

Unknown
01-26-2004, 04:10 AM
Could you explain it to a complete noob to DOS and sea shells

Mhtml
01-26-2004, 04:13 AM
lol sea shells..

Well a shell basically handles the commands you want to execute.

You need that ; there because it's a function call and c++ syntax says you need a ; after calls and assignments.

[edit:] I don't have sufficient permissions to remove that post. It'll be alright, not worth bothering about ;) ... You can edit your own posts of course.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum