Thread: Dev-C++

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    18

    Dev-C++

    I have Dev-C++ and when I execute the program, the Dev-C++ screen minimizes and the executable screen pops up, but for only a second and then the Dev-C++ screen pops back up. I am not able to run my programs...does anyone know what I can do to fix this.....?

  2. #2
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    When you run a console program, unless you tell it to stop with getch or something similar, it's jsut going to close the console window.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    18

    im not familiar with getch

    can someone help me on how to use it....

  4. #4
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Check your PMs.

  5. #5
    Registered User
    Join Date
    Jan 2002
    Posts
    18
    i put:

    int getch();

    at the beginning, in the main, and at the end and nothing works....

  6. #6
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    You're declaring getch() as a variable - that's wrong.

    Put this line right before the reutrn statement at the end of main:

    getch();


    That's it - nothing else.

  7. #7
    Registered User
    Join Date
    Jan 2002
    Posts
    18
    then i get the error message:

    implicit declaration of function `int getch(...)'

  8. #8
    Registered User
    Join Date
    Jan 2002
    Posts
    49
    Try adding this header file :

    #include <conio.h>

  9. #9
    Registered User
    Join Date
    Jan 2002
    Posts
    18
    still didn't work....i don't know what's up but i am downloading borland 5.5 now....hopefully i won't have the same problem....

  10. #10
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb your answer

    I use this and had the same problem a long time ago. You can't use conio.h with Dev-C++. It uses:

    #include <conio.c>
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: [email protected]

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

  11. #11
    Mayor of Awesometown Govtcheez's Avatar
    Join Date
    Aug 2001
    Location
    MI
    Posts
    8,823
    Post your exact code - this isn't that difficult.

  12. #12
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    You need either

    #include <stdio.h>
    #include <conio.h>

    or

    #include <conio_mingw.h>

    to use getch().

    You could do -

    #include <stdlib.h>

    and use

    system("PAUSE");

    or write more portable code and do -

    #include <iostream>

    and use

    std::cin.get();

    or you could use any other function that accepts input from stdin and therefore pauses the program before the end.

  13. #13
    Registered User
    Join Date
    Jan 2002
    Posts
    18
    Thanks to everyone.....the <conio.c> worked. wow what a hassle. THanks a lot though....

  14. #14
    Registered User
    Join Date
    Jan 2002
    Posts
    49
    surprising !!!
    In Dev-C++ 4 it's conio.h

  15. #15
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    I've had the same problems too. You kinda get used to it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  2. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  3. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 3
    Last Post: 03-08-2004, 08:47 PM
  4. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 1
    Last Post: 03-08-2004, 05:19 PM
  5. DEV C++ Limitations?
    By Kirdra in forum Game Programming
    Replies: 3
    Last Post: 09-09-2002, 09:40 PM