Thread: "delay()" does not works in windows 7

  1. #1
    Registered User
    Join Date
    Oct 2010
    Location
    Rajshahi, Bangladesh
    Posts
    2

    "delay()" does not works in windows 7

    Hello,

    I am using borland c++ compiler and windows 7 operating system. I am tryring to make delay using the delay() function under dos.h header file. But the compiler says "call to undefined function delay. Can any one help me what is the problem

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    You can not use any function in the conio.h in Windows programs. This header is obsolete and most of the functions are only usable in "real" DOS.

    Jim

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    107
    Undefined reference is a linker error. You need to link against whatever static library defines delay(). Unfortunately, after Googling, I have no idea what library that would be. Try sleep? Sleep is defined in <unistd.h>

  4. #4
    Registered User
    Join Date
    Oct 2010
    Location
    Rajshahi, Bangladesh
    Posts
    2
    Thank you for your kind reply. The "sleep()" function under <dos.h> is working nicely also the "Sleep()" under <windows.h> is working. may be u are right, the delay() function will not work under windows 7.

    bappi

  5. #5
    Registered User
    Join Date
    Oct 2010
    Posts
    107
    Glad to help. If you'd ever like to try Linux development, things are relatively standard, and as far as I know, you won't find broken API stuff like this. Ubuntu is a pretty good distribution. I recommend it. You can also play Starcraft II on it just fine.

  6. #6
    and the hat of sweating
    Join Date
    Aug 2007
    Location
    Toronto, ON
    Posts
    3,545
    Quote Originally Posted by jimblumberg View Post
    You can not use any function in the conio.h in Windows programs. This header is obsolete and most of the functions are only usable in "real" DOS.

    Jim
    I think you mean <dos.h>, not <conio.h>. I use getch() from <conio.h> in Windows just fine.
    "I am probably the laziest programmer on the planet, a fact with which anyone who has ever seen my code will agree." - esbo, 11/15/2008

    "the internet is a scary place to be thats why i dont use it much." - billet, 03/17/2010

  7. #7
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    @cpjust you are correct, but dos.h and conio.h are considered obsolete....

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling C in Visual Studio 2005
    By emanresu in forum C Programming
    Replies: 3
    Last Post: 11-16-2009, 04:25 AM
  2. I dont get this working on gcc it works fine in windows
    By wise_ron in forum C Programming
    Replies: 8
    Last Post: 05-08-2006, 05:33 AM
  3. GUI library that works on windows and linux?
    By Logan in forum C++ Programming
    Replies: 2
    Last Post: 04-28-2006, 08:40 PM
  4. Program works on Windows XP and 2000, not on 98 or ME
    By MidnightlyCoder in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2006, 03:36 PM
  5. FlashWindowEx not declared?
    By Aidman in forum Windows Programming
    Replies: 3
    Last Post: 05-17-2003, 02:58 AM

Tags for this Thread