Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Complier Problems

    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.

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Do a pause there - wait for the user to press a key or something. Or, run it from the command prompt.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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?!?!
    Last edited by Unknown; 01-25-2004 at 07:20 PM.

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Hmm, seems like
    Code:
    #include <instream.h>
    is not the correct header inclusion, use
    Code:
    #include <iostream>
    using namespace std
    instead.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Nope nothing will work...Don't know why.. any compiler suggestions???!?!

  • #6
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #7
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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

  • #8
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    To 4!!! 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.
    Omnis mico antequam dominus Spookster!

  • #9
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Ya i just noteiced how ugly versoin 4 is. I'm think of reinstalling 5. That would be the 5th time i install it

  • #10
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    lol.
    Omnis mico antequam dominus Spookster!

  • #11
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts
    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

  • #12
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Ok show me your code. It's saying there is an error before the return statement.
    Omnis mico antequam dominus Spookster!

  • #13
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts
    [CODE}#include <iostream.h>

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

  • #14
    New Coder
    Join Date
    Jan 2004
    Location
    Illinois
    Posts
    72
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Code:
    #include <iostream.h>
    
     int main()
    {
       cout << "Hello World!\n";
         system("PAUSE")
         return 0;
    }

  • #15
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Just as I suspected you are missing the ; after the system command.
    Omnis mico antequam dominus Spookster!


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •