Menu

RT: Testing: A Simple Hello World Program

Wayne Keen
2004-03-09
2012-09-26
<< < 1 .. 3 4 5 6 > >> (Page 5 of 6)
  • Nobody/Anonymous

    yes, system("pause") will work under DOS only, indeed it is a legacy DOS function that was frequently used in batch files.
    However, please note that you cannot create DOS executable with DevCPP/MingW32.

    Mike

     
    • Nobody/Anonymous

      Mike,

      The pause also works under Windows XP for example, in which there is NO DOS. At all.

      Wayne

       
  • Nobody/Anonymous

    I am using Dev-C++ 4.9.8.9

    my code

    include<iostream>

    include<stdlib.h> //only needed if you are using Dev 4 family

    using namespace std; //where the names are - like cout!

    int main(void)
    {
    cout << "This is what that putz Wayne said to do!\n";
    system("pause"); //keep the window open if running from Dev
    return 0;
    }

    (The same as the first one i wanted to test it.)

    I cant see my compile log because it comes up then leaves quickly automatically (like less than half a second...anyone know a reason why??) Then at the bottom it says unable to run program file. Soo.. if i go to Execute Run it says Source file not compiled. Help would be appreciated thanks.

     
  • Nobody/Anonymous

    The log is on the tab labeled "Compile Log", it does not come up and leave.

    Please start a new thread with your question, remembering to post your "Basic 3"

    Wayne

    p.s. Are you sure it is 4.9.8.9?

     
  • Nobody/Anonymous

    yeah it says 4.9.8.9 in the top left corner.

     
  • Nobody/Anonymous

    That version has got the be a year or more old, I would recommend doing a clean uninstall (see directions in the thread PLEASE READ BEFORE ASKING A QUESTION) on how to do that.

    And please start a new thread if you are still having issues...

    Wayne

     
  • Nobody/Anonymous

    Ok guys i just installed 4.9.7.0 from the C++ dummies guide. So of course it does not compile properly becuase i quess its not a full install.

    which version do i download now to get this bady up and running.

    Stev

     
  • Nonamer

    Nonamer - 2007-11-20
    1. My Dev-c++ version is 4.9.9.2

    2. include<istream>

    include<stdlib.h>

    using namespace std;

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

    1. make.exe -f "C:\Documents and Settings\Jimmie\Skrivbord\Scripts\Prov1\Makefile.win" all
      g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

    main.cpp: In function int main()': main.cpp:8: error:cout' undeclared (first use this function)
    main.cpp:8: error: (Each undeclared identifier is reported only once for each function it appears in.)
    main.cpp:10: error: expected `;' before "return"

    make.exe: *** [main.o] Error 1

    1. My problem is that when i'm trying to start the program.. nothing happens, Not an singel window popps up.. I have try 3 diffrent codes and still nothing..!
     
    • Osito

      Osito - 2007-11-20

      You have a lot of typos. The one causing cout not to be found is that it's called iostream not istream.

       
  • Nonamer

    Nonamer - 2007-11-20

    I fixed it.. but it's still one error with: "Return 0;"

    make.exe -f "C:\Documents and Settings\Jimmie\Skrivbord\Scripts\Prov1\Makefile.win" all
    g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

    main.cpp: In function int main()': main.cpp:8: error:cout' undeclared (first use this function)
    main.cpp:8: error: (Each undeclared identifier is reported only once for each function it appears in.)
    main.cpp:10: error: expected `;' before "return"

    make.exe: *** [main.o] Error 1

     
    • Osito

      Osito - 2007-11-20

      Actually it still says you have the same error. Are you sure you fixed the iostream typo?

       
  • Nonamer

    Nonamer - 2007-11-20

    This is the code now:

    include<iostream>

    include<stdlib.h>

    using namespace std;

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

     
    • Osito

      Osito - 2007-11-20

      That log you posted isn't from the code you posted. But your next typo is the missing semicolon right before return 0;

      Any time it gives you a line number of an error, you should start by also checking the line before it. A lot of times a missing semicolon, bracket, close parentheses, etc, on one line can cause the error to appear to be on the following line.

       
  • Nonamer

    Nonamer - 2007-11-20

    Btw, sorry for dubbel posting, but heres another one: 10 C:\Documents and Settings\Jimmie\Skrivbord\Scripts\Prov1\main.cpp expected ;' before &quot;return&quot; C:\Documents and Settings\Jimmie\Skrivbord\Scripts\Prov1\main.cpp In functionint main()':

    (srry im swedish)

     
  • Nonamer

    Nonamer - 2007-11-20

    Ok anoying, still an ERROR..

    include<iostream>

    include<stdlib.h>

    using namespace std;

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

    make.exe -f "C:\Documents and Settings\Jimmie\Skrivbord\Scripts\Prov1\Makefile.win" all
    g++.exe -c Namnlös1.cpp -o Namnlös1.o -I"C:/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"C:/Dev-Cpp/include/c++/3.4.2/backward" -I"C:/Dev-Cpp/include/c++/3.4.2/mingw32" -I"C:/Dev-Cpp/include/c++/3.4.2" -I"C:/Dev-Cpp/include"

    g++.exe: Namnl÷s1.cpp: No such file or directory
    g++.exe: no input files

    make.exe: *** [Namnlös1.o] Error 1

    Is it me who alwayse get it wrong? becus i got the first code from: "Accelerated C++ 2000"

    and there the code is:

    include <iostream>

    int main()
    {
    std::cout << "Hello, world!" << std::endl;
    return 0;
    }

     
    • Osito

      Osito - 2007-11-20

      That last error looks like it didn't recognize the character in the filename:

      g++.exe: Namnl÷s1.cpp: No such file or directory

      Was it originally called main.cpp? Because you didn't have that error when you started.

       
  • Nonamer

    Nonamer - 2007-11-20

    Yea! worked! but now it's the window xD just show one sec and then it's quits :/ By the way, thanks so mutch all for your help!

     
    • Osito

      Osito - 2007-11-20

      The window closes because you have paus instead of pause in your system command.

       
  • Nonamer

    Nonamer - 2007-11-20

    Haha =P it worked but it did not say "Hello World" It's says "press any key to continu"

     
    • Wayne Keen

      Wayne Keen - 2007-11-21

      Odds are you compiled your code as windows project, and not a console project.

      Please start a new thread, and post your Basic 3 there.

      Future posters;

      If a thread starts with RT, it is an informational thread, please do
      not use it to post questions.

      Thanks,

      Wayne

       
    • Osito

      Osito - 2007-11-20

      You're saying this code doesn't print Hello World?

      include<iostream>

      include<stdlib.h>

      using namespace std;

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

       
  • Nathaniel

    Nathaniel - 2008-12-17

    Os is Windows Vista, I'm running Dev-C++ 4.9.9.2

    include <cstdlib>

    include <iostream>

    using namespace std;

    int main(int argc, char *argv[])
    {
    cout << "Hello, this is your computer speaking." << end1;
    system("PAUSE");
    return EXIT_SUCCESS;
    }

    In function int main(int, char**)':end1' undeclared (first use this function)
    (Each undeclared identifier is reported only once for each function it appears in.)

    Seems as though I'm have a bit of trouble with the "end1" clause.

    Any help would be much appreciated!
    Thanks
    Nathaniel.

     
  • Nathaniel

    Nathaniel - 2008-12-17

    Please ignore my last question, (wow I feel so dumb --...) Anyways I thought this whole time it was end1 and not endl --.... sorry for being ignorant and wasting time and thread =).

    Nathaniel.

     
  • Wayne Keen

    Wayne Keen - 2008-12-17

    If a thread starts with RT, it is an informational thread, please do
    not use it to post questions.

    Thanks,

    Wayne

     
  • Anonymous

    Anonymous - 2011-03-12

    do you want to upgrade quickly in maple story?why not Buy Maplestory
    Mesos
    to enlarge your enquipment?our website
    sellCheap Maplestory Mesos and provide all
    kinds of service.get going!you will get more discount when you Buy Maplestory
    Mesos
    from us.

     
<< < 1 .. 3 4 5 6 > >> (Page 5 of 6)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.