Thread: newbie question ...

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    3

    newbie question ...

    Sorry to detract your time away from real programming problems but I'm just starting out in C++, have a ver of Dev C, am working through the tutorials, and am finding that none of my compiled .exe files will run. Before I go any farther, I need to get to the bottom of that, because it's apparantly not my simplistic code at fault.

    Last sample was :
    Code:
    #include<iostream>
    using namespace std;
    int main()
    {
        int thenumber;
        cout<<"Please enter a number.";
        cin>> thenumber;
        cin.ignore();
        cout<<"You entered: "<< thenumber <<"\n";
        cin.get();
    }
    and the make looks like :

    Code:
    Compiler: Default compiler
    Building Makefile: "C:\Dev-Cpp\Makefile.win"
    Executing  make clean
    rm -f Projects/Openers3.o  Openers3.exe
    
    g++.exe -c Projects/Openers3.cpp -o Projects/Openers3.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 Projects/Openers3.o  -o "Openers3.exe" -L"C:/Dev-Cpp/lib" -mwindows  
    
    Execution terminated
    Compilation successful
    After this, nothing loads at all from the .exe. It's one project, started as an .exe, and the single code file. Any suggestions?
    Should I try re-installing Dev, or am I overlooking something in my configuration of it, etc?
    Last edited by Tylansala; 06-11-2005 at 05:30 PM.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Location
    Philadelphia
    Posts
    16
    I dont use Dev-C++, it compiles/runs fine for me using VC++. Try adding return 0; at the end of main, that -might- solve it.

  3. #3
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Perhaps try flushing the output buffer.
    cout.flush( ) or cout << endl (that's an L not a 1) will do it for ya. It works in gcc 3.3 (and Dev-C++ uses gcc as the compiler).
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  4. #4
    Registered User
    Join Date
    Apr 2003
    Posts
    2,663
    am working through the tutorials, and am finding that none of my compiled .exe files will run. Before I go any farther, I need to get to the bottom of that
    Ahh! I wouldn't worry about it. You've come this far, why turn back now?
    Last edited by 7stud; 06-11-2005 at 06:32 PM.

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    3
    I've added a Return 0; (once, where it should be) and << endl; at the end of both couts, spaced all my statements as per examples (including between <<'s), and the thing still won't run an .exe - it's got me perplexed as it will compile and run an output screen for the Hello World project they supplied (which I compiled). Lol, I'm obviously missing something, but I still wonder what.

    I'll keep experimenting.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    3
    Okay, I figured it : I had to set up my project options to output to the Console, courtesy of the Hello World example actually. On with the tutorials, and hopefully no more lousy little problems like that.

    Thanks for suggestions

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  4. confusion with integers (newbie question)
    By imortal in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 04:09 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 09:50 AM