Menu

RT: Testing: A Simple Hello World Program

Wayne Keen
2004-03-09
2012-09-26
<< < 1 2 3 4 5 6 > >> (Page 4 of 6)
  • S. Thomas Bradley

    Hi Everyone:

    I didn't pay enough attention to the errors before. He's using spaces in the pathname:

    g++.exe "C:\Documents and Settings\Owner\Desktop\dfgdfg.cpp" -o "C:\Documents and Settings\Owner\Desktop\dfgdfg.exe"

    If he is selecting Compile and Run and it is not invoking the compiler, I still think that the Project file may be corrupted. As I recall from last year the compiler was giving errors that had absolutely nothing to do with what the actual problem was.

    At that time they couldn't compile anything either, even when they did as this person has done and tried to compile the "Hello, World". I think they were also getting errors that referenced the Borland compiler.

    Anyway, deleting the Project file is a pretty simple thing and if it doesn't work he will have only lost 5 minutes.

    See Ya
    Butch

     
    • Wayne Keen

      Wayne Keen - 2005-06-22

      Butch,

      Look at the errors again. Make is not being invoked to do the compile, g++ is.

      Wayne

       
  • Nobody/Anonymous

    Reinstall it is, then.

     
  • S. Thomas Bradley

    I'm assuming the above post is from the OP and my suggestion didn't work so then you're right, Wayne, the easiest solution is a clean reinstall.

    I do find it odd that his compiler was working fine and then one day, for no reason, nothing would compile. I am, of course, making the assumption that if everything was working and then he upgraded Dev-C++, then everything stopped working, he would have said so. But then, as we all know, sometimes you've got to pry info out of people.

    See Ya
    Butch

     
    • Wayne Keen

      Wayne Keen - 2005-06-22

      Yep, humor at my expense, given that his paths were screwed up, I assumed an upgrade issue, and that like many, they had not mentioned an upgrade.

      Wayne

       
  • Nobody/Anonymous

    Hey All, Great thread btw,..I just started using Dev C++ and have the same error log as above,..you know ,..the 90 total errors,..
    Anyway ,. I first installed Dev C++ from a CD that came with a book then saw there was the newer version (4.9.9.2) so of course I installed it and got the same error on Hello World,.
    Gona clean reinstall now and get it up.
    just wanted to say Thanks!

     
  • jon

    jon - 2005-07-20

    Windows XP version 4.9.7.0, I also got the same thing on the newest version.

    I first copied your code which was:

    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;
    }

    this was my log:

    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "C:\mystuff\Untitled2.cpp" -o "C:\mystuff\Untitled2.exe" -I"C:\Dev-Cpp\include" -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
    In file included from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/iostream:44:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/ios:44,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/iosfwd:44:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/iosfwd:45,

                 from C:/Dev-Cpp/include/c++/ios:44,
                 from C:/Dev-Cpp/include/c++/ostream:45,
    
                 from C:/Dev-Cpp/include/c++/iostream:45,
                 from C:/mystuff/Untitled2.cpp:1:
    

    C:/Dev-Cpp/include/c++/bits/stringfwd.h:44:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/iosfwd:46,
    from C:/Dev-Cpp/include/c++/ios:44,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/bits/fpos.h:44:24: bits/c++io.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/fpos.h:45,
    from C:/Dev-Cpp/include/c++/iosfwd:46,
    from C:/Dev-Cpp/include/c++/ios:44,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/cwchar:49:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/iosfwd:46,
    from C:/Dev-Cpp/include/c++/ios:44,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/bits/fpos.h:60: 'streamoff' is used as a type, but is
    not defined as a type.
    C:/Dev-Cpp/include/c++/bits/fpos.h:74: parse error before __off' C:/Dev-Cpp/include/c++/bits/fpos.h:75: missing ';' before right brace C:/Dev-Cpp/include/c++/bits/fpos.h:77: semicolon missing after declaration of
    std::fpos<_StateT>'
    C:/Dev-Cpp/include/c++/bits/fpos.h: In constructor
    std::fpos&lt;_StateT&gt;::fpos()': C:/Dev-Cpp/include/c++/bits/fpos.h:72: classstd::fpos<_StateT>' does not have
    any field named _M_off' C:/Dev-Cpp/include/c++/bits/fpos.h: At global scope: C:/Dev-Cpp/include/c++/bits/fpos.h:77: parse error before(' token

    C:/Dev-Cpp/include/c++/bits/fpos.h:77: ISO C++ forbids defining types within
    return type
    C:/Dev-Cpp/include/c++/bits/fpos.h:77: syntax error before (' token C:/Dev-Cpp/include/c++/bits/fpos.h:79: syntax error before&' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:82: syntax error before &amp;' token C:/Dev-Cpp/include/c++/bits/fpos.h:86: syntax error beforeoperator'
    C:/Dev-Cpp/include/c++/bits/fpos.h:89: syntax error before +=' token C:/Dev-Cpp/include/c++/bits/fpos.h:94: syntax error beforeoperator'
    C:/Dev-Cpp/include/c++/bits/fpos.h:97: syntax error before -=' token C:/Dev-Cpp/include/c++/bits/fpos.h:102: parse error before&' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:103: non-member function bool operator==(...)' cannot haveconst' method qualifier
    C:/Dev-Cpp/include/c++/bits/fpos.h:103: bool operator==(...)' must have an argument of class or enumerated type C:/Dev-Cpp/include/c++/bits/fpos.h:103:bool operator==(...)' must take
    exactly two arguments
    C:/Dev-Cpp/include/c++/bits/fpos.h: In function bool operator==(...)': C:/Dev-Cpp/include/c++/bits/fpos.h:103:_M_off' undeclared (first use this
    function)
    C:/Dev-Cpp/include/c++/bits/fpos.h:103: (Each undeclared identifier is reported
    only once for each function it appears in.)
    C:/Dev-Cpp/include/c++/bits/fpos.h:103: __pos' undeclared (first use this function) C:/Dev-Cpp/include/c++/bits/fpos.h: At global scope: C:/Dev-Cpp/include/c++/bits/fpos.h:106: parse error before&' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:107: non-member function bool operator!=(...)' cannot haveconst' method qualifier
    C:/Dev-Cpp/include/c++/bits/fpos.h:107: `bool operator!=(...)' must have an
    argument of class or enumerated type

    C:/Dev-Cpp/include/c++/bits/fpos.h:107: bool operator!=(...)' must take exactly two arguments C:/Dev-Cpp/include/c++/bits/fpos.h:110: parse error before)' token
    C:/Dev-Cpp/include/c++/bits/fpos.h:113: streamoff' was not declared in this scope C:/Dev-Cpp/include/c++/bits/fpos.h:113: parse error before)' token
    C:/Dev-Cpp/include/c++/bits/fpos.h: In function void _M_position(...)': C:/Dev-Cpp/include/c++/bits/fpos.h:113:__off' undeclared (first use this
    function)
    C:/Dev-Cpp/include/c++/bits/fpos.h: At global scope:
    C:/Dev-Cpp/include/c++/bits/fpos.h:114: parse error before }' token C:/Dev-Cpp/include/c++/bits/fpos.h:117: syntax error before;' token

    In file included from C:/Dev-Cpp/include/c++/ios:46,
    from C:/Dev-Cpp/include/c++/ostream:45,

                 from C:/Dev-Cpp/include/c++/iostream:45,
                 from C:/mystuff/Untitled2.cpp:1:
    

    C:/Dev-Cpp/include/c++/bits/char_traits.h:59: parse error before ;' token C:/Dev-Cpp/include/c++/bits/char_traits.h:60: parse error before;' token
    C:/Dev-Cpp/include/c++/bits/char_traits.h:113: parse error before ;' token C:/Dev-Cpp/include/c++/bits/char_traits.h:114: parse error before;' token

    C:/Dev-Cpp/include/c++/bits/char_traits.h: In static member function static int std::char_traits&lt;char&gt;::eof()': C:/Dev-Cpp/include/c++/bits/char_traits.h:168:EOF' undeclared (first use this
    function)

    In file included from C:/Dev-Cpp/include/c++/ios:47,
    from C:/Dev-Cpp/include/c++/ostream:45,

                 from C:/Dev-Cpp/include/c++/iostream:45,
                 from C:/mystuff/Untitled2.cpp:1:
    

    C:/Dev-Cpp/include/c++/cstdio:49:28: bits/c++config.h: No such file or directory

    In file included from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,

                 from C:/Dev-Cpp/include/c++/iostream:45,
                 from C:/mystuff/Untitled2.cpp:1:
    

    C:/Dev-Cpp/include/c++/bits/localefwd.h:45:28: bits/c++config.h: No such file or directory
    C:/Dev-Cpp/include/c++/bits/localefwd.h:46:80: bits/c++locale.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/localefwd.h:48,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/cctype:48:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/string:45:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/memory:54,
    from C:/Dev-Cpp/include/c++/string:48,
    from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/bits/stl_algobase.h:64:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/stl_algobase.h:67,
    from C:/Dev-Cpp/include/c++/memory:54,
    from C:/Dev-Cpp/include/c++/string:48,
    from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/cstdlib:49:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/stl_algobase.h:72,

                 from C:/Dev-Cpp/include/c++/memory:54,
                 from C:/Dev-Cpp/include/c++/string:48,
                 from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
                 from C:/Dev-Cpp/include/c++/ios:48,
                 from C:/Dev-Cpp/include/c++/ostream:45,
                 from C:/Dev-Cpp/include/c++/iostream:45,
    
                 from C:/mystuff/Untitled2.cpp:1:
    

    C:/Dev-Cpp/include/c++/bits/type_traits.h:54:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/stl_iterator_base_funcs.h:68,
    from C:/Dev-Cpp/include/c++/bits/stl_algobase.h:74,
    from C:/Dev-Cpp/include/c++/memory:54,
    from C:/Dev-Cpp/include/c++/string:48,
    from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:
    C:/Dev-Cpp/include/c++/bits/concept_check.h:40:28: bits/c++config.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/stl_alloc.h:86,
    from C:/Dev-Cpp/include/c++/memory:55,
    from C:/Dev-Cpp/include/c++/string:48,

                 from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
                 from C:/Dev-Cpp/include/c++/ios:48,
                 from C:/Dev-Cpp/include/c++/ostream:45,
                 from C:/Dev-Cpp/include/c++/iostream:45,
                 from C:/mystuff/Untitled2.cpp:1:
    

    C:/Dev-Cpp/include/c++/bits/stl_threads.h:52:23: bits/gthr.h: No such file or directory
    In file included from C:/Dev-Cpp/include/c++/bits/stl_alloc.h:86,
    from C:/Dev-Cpp/include/c++/memory:55,
    from C:/Dev-Cpp/include/c++/string:48,
    from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
    from C:/Dev-Cpp/include/c++/ios:48,
    from C:/Dev-Cpp/include/c++/ostream:45,
    from C:/Dev-Cpp/include/c++/iostream:45,
    from C:/mystuff/Untitled2.cpp:1:

    C:/Dev-Cpp/include/c++/bits/stl_threads.h: At global scope:
    C:/Dev-Cpp/include/c++/bits/stl_threads.h:69: 'gthread_mutex_t' is used as a
    type, but is not defined as a type.
    C:/Dev-Cpp/include/c++/bits/stl_threads.h:79:2: #error
    GTHREAD_MUTEX_INIT or GTHREAD_MUTEX_INIT_FUNCTION should be defined by gthr.h abstraction layer, report problem to libstdc++@gcc.gnu.org.
    C:/Dev-Cpp/include/c++/bits/stl_threads.h: In member function void std::_Refcount_Base::_M_incr()': C:/Dev-Cpp/include/c++/bits/stl_threads.h:86:_M_ref_count_lock' undeclared
    (first use this function)
    C:/Dev-Cpp/include/c++/bits/stl_threads.h:86: __gthread_mutex_lock' undeclared (first use this function) C:/Dev-Cpp/include/c++/bits/stl_threads.h:88:
    gthread_mutex_unlock'
    undeclared (first use this function)
    C:/Dev-Cpp/include/c++/bits/stl_threads.h: At global scope:
    C:/Dev-Cpp/include/c++/bits/stl_threads.h:158: '__gthread_mutex_t' is used as a
    type, but is not defined as a type.
    C:/Dev-Cpp/include/c++/bits/stl_threads.h: In member function void std::_STL_mutex_lock::_M_acquire_lock()': C:/Dev-Cpp/include/c++/bits/stl_threads.h:192:_M_lock' undeclared (first use
    this function)
    In file included from C:/Dev-Cpp/include/c++/memory:55,
    from C:/Dev-Cpp/include/c++/string:48,
    from C:/Dev-Cpp/include/c++/bits/localefwd.h:49,
    from C:/Dev-Cpp/include/c++/ios:48,

                 from C:/Dev-Cpp/include/c++/ostream:45,
                 from C:/Dev-Cpp/include/c++/iostream:45,
                 from C:/mystuff/Untitled2.cpp:1:
    

    C:/Dev-Cpp/include/c++/bits/stl_alloc.h: At global scope:
    C:/Dev-Cpp/include/c++/bits/stl_alloc.h:575: syntax error before `;' token
    C:/Dev-Cpp/include/c++/bits/stl_alloc.h:575: confused by earlier errors, bailing out

    Execution terminated

    Thanks for any help.

     
  • Wayne Keen

    Wayne Keen - 2005-07-21

    4.9.7.0 is very old an very buggy.

    Unless you follow the directions in te FAQ thread on doing a clean uninstall, 4.9.9.2 will be fouled up.

    You need to do a complete uninstall, using the FAQ directions, and install 4.9.9.2 (please never refer to a release as "newest") from scratch.

    Wayne

     
  • Nobody/Anonymous

    Using Clean Install of DEv C++ 4.9.9.2
    I am a absolute beginner in programming and would like to know what I am doing wrong:
    Code:

    include <stdio.h>

    main()
    {
    printf("Hello, world!\n");
    return 0;
    }

    When I go to the directory where main.exe is made, I run the exe and nothing happens. This is my Compile Log: "Compiler: Default compiler
    Executing g++.exe...
    g++.exe "G:\Programing\C\Projects\main.cpp" -o "G:\Programing\C\Projects\main.exe" -fexpensive-optimizations -O3 -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" -L"C:\Dev-Cpp\lib"
    Execution terminated
    Compilation successful
    "
    Any help?

     
  • Wayne Keen

    Wayne Keen - 2005-07-29

    You ignored the part about system("pause"). Its the original code for a reason.

    In addition, you are writing code as C, but you gave it a name, main.cpp, that means it will be compiled as C++. What was your real intent there?

    Wayne

     
  • Nobody/Anonymous

    in what way do you run it ?
    given your above code you probably want to open a console and run it from there

     
  • Nobody/Anonymous

    Hehe, well no that was not my intent. What is this about "system(pause)"? But when I re check my work with C specified. I get this for the Compile Log: " Compiler: Default compiler
    Executing gcc.exe...
    gcc.exe "E:\Documents and Settings\Administrator\Desktop\main.c" -o "E:\Documents and Settings\Administrator\Desktop\main.exe" -fexpensive-optimizations -O3 -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
    Execution terminated
    Compilation successful" (Yes I did use a different directory). After this, I still click up main.exe and I still see nothing on my screen.

    I ran it by compiling, run and compile.

     
    • Rob Andrews

      Rob Andrews - 2005-07-29

      Have you checked out my step-by-step "tutorial" for compiling and running a Hello World program?

      http://uselesspython.com/devcpp/DevCppQuickStartTutorial.pdf

      If not, it may prove helpful.

       
  • Nobody/Anonymous

    Hey man thanks! I did check out your tutorial and I was stupid enough not to open my program in CMD to see "Hello, World!". But much thanks.

     
  • Nobody/Anonymous

    I installed DEV-C++ 4.9.9.1 on my Win98 PC. The example programs on the installation CD seem to produce console displays quite nicely when I compile/run them. However, when I create my own HELLO WORLD program, and then run/execute it, it flashes the "Hello World" console window message for only a split second - almost too fast to read it! I've tried fiddling with several different Project, Compiler and Environment option settings, but to no avail. Any suggestions, please, to get the console window to remain open after executing my .cpp program? Tx...Murph

     
    • Nobody/Anonymous

      just put :

      system("pause");

      before your "return 0;" at the end of your main ;-)

       
  • Wayne Keen

    Wayne Keen - 2005-08-04

    The very example program that starts this thread shows you how to do it.

    Wayne

     
  • Nobody/Anonymous

    Thanks for the direction. It appears the only thing that was missing from my program was the line "system("pause");". My HELLO WORLD program works fine now. I'm somewhat puzzled, though, as none of the C++ example programs on my CD seem to have this line, and yet they all work fine! Clearly I've got a lot to learn!!
    Tx...Murph (C++ newby!!)

     
  • Wayne Keen

    Wayne Keen - 2005-08-05

    This was not intended by the way as a thread on which questions are asked. If you have a question, I encourate you to start s separate thread. Please remember to include with your question your "Basic 3" - see the FAQ thread in the forum if you do not know what that is.

     
  • Nobody/Anonymous

    I have v 4

    include<iostream>

    include<stdlib.h>

    int main(void)
    {
    cout << "This is what that putz Wayne said to do!\n";
    system("pause");
    return 0;
    }

    compile log
    Compiling files :
    C:\DEV-C_~1\Bin\g++ c:\docume~1\kathy~1.ibm\mydocu~1\untitl~1.cpp -o c:\docume~1\kathy~1.ibm\mydocu~1\Untitl~1.exe -s -IC:\DEV-C_~1\Include\ -IC:\DEV-C_~1\Include\G__~1 -IC:\DEV-C_~1\Include\ -LC:\DEV-C_~1\Lib\ -BC:\DEV-C_~1\Bin\
    I did what you suggested and it worked. There was no problem. However my compile log looks alot different. I am a newbie - I mean 2 days new. If the compile log is doing something unusual I would not know it.No response means ok?

     
  • Nobody/Anonymous

    The compile log for version 4 is in fact much different.

    Personally, I would ditch version 4. It is very old and has not been updated/supported for almost 5 years.

    Wayne

     
  • Nobody/Anonymous

    This MY C++ "Hello World!"

    include<iostream>

    using namespace std;

    int main()
    {
    cout << "Hello World!"; // Print "Hello World!"
    cin.get(); // Wait for user to press enter
    return 0;
    }

     
    • Nobody/Anonymous

      And this is mine version.
      I am running 4.9.9.2 under the Win 98

      include<iostream>

      int main(void)
      {
      puts ("This is the other way");
      getchar();
      return 0;
      }

      I want ask if system("pause"); will work only with MS DOS?

      And isn`t simplest write just std::cout << "Hello\n"; without longer using namespace std; in this case? Of course if we use cout not puts

       
  • Luke

    Luke - 2005-12-04

    That code will NOT compile. puts() is not in iostream. I have never used any other OS than Windows so I don't know if system("pause") will work. Here is the closest I can get to it though:
    printf("Press Enter to continue . . . ");
    getchar();

     
    • Nobody/Anonymous

      What are you mean by "That code will NOT compile"? I have no problems with compile with puts()

       
<< < 1 2 3 4 5 6 > >> (Page 4 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.