![]() |
function errors
hello
can any body how to correct this program :
#include<iostream>The errors are 'main must return int' 'delay' function undeclared Iam using DevCpp iam new to it before i was using Turbo C++ please anybody help me |
the last statment in main should be "return 0;"
delay is a function with in dos.h and if the compiler could not find dos.h it should have said so. im not sure why it does not like the delay function. what OS are you trying to compile this on? search for dos.h and delay for more help |
I am using Windows XP and my compiler is Dev C++
and does a void function return a value ? and why does delay function doesn't work |
The error "main must return int" is fairly self-explanatory. Change your definition of main() so it returns int rather than void. The C and C++ standards require compilers to support main() that returns int. While returning void is not disallowed, there is no requirement for any compiler to allow it.
The delay() function, like the <dos.h> and <conio.h> header files, are implementation specific --- they are not specified in the C/C++ standards, but some compilers support them as an extension. In other words, they are supported by some compilers/libraries but not others. dev C++ is obviously a compiler that does not support the delay() function. |
dev-C++ does not support the function delay with in dos.h
http://cboard.cprogramming.com/archi...hp/t-8593.html do some searching on the topic. you will need to make your own delay function or swtich OS or compiler |
yeah, main must return an int. change it from void to int.
try sleep() from <cstdlib> (i think i may be wrong) yeah, this is the gay shit we have to do. you're using unstandardized crap. you get unstandardized results (like compiler errors). |
Quote:
|
if you need to creat a delay use the system timer with a loop. there are plenty of examples of delay loops, google for them
|
I think this is an example where at least one of those errors was extremely self-explanatory.
Quote:
|
Pertaining to the delay-function:
I would implement the "delay"-function in my C++ code like this... :
#if __linux__ |
| All times are GMT -5. The time now is 1:21 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC