c++ - ' ' was not declared in this scope -
i'm new , can't understand meaning of "not declared in scope" error. tried declaring these functions , using "" show function did not compile , run. here errors:
in function 'int main()':
[error] 'random' not declared in scope
[error] 'sound' not declared in scope
[error] 'delay' not declared in scope
[error] 'nosound' not declared in scope
[error] 'blink' not declared in scope
[error] 'textattr' not declared in scope
#include<stdio.h> #include<iostream> #include<dos.h> #include<conio.h> #include<stdlib.h> using namespace std; int main () { int count=50; while(count--) { sound(90*random(10)); delay(100); nosound(); textattr(random("16")+'a'+blink); cprintf("kshitij"); } }
looks have turbo c++ code in 1990's. last version of turbo c++ released before standardized c++, it's missing stuff , other stuff oddly. contains large bundle of own libraries can't found anywhere else. it's hard find decent support these days you're noticing.
' ' not declared in scope
is compiler saying, "this name has not been defined." it's prompt you've missed header. in case have right headers, don't contain these turbo c++-only functions. means need find alternatives supported modern compilers.
random
can replaced std::uniform_int_distribution
sound(90*random(10)); delay(100); nosound();
can replaced the win32 call beep
textattr
, cprintf
you're better off without. blink pain in posterior re-implement in gcc. there might win32 call this, i've never tried , @ loss.
Comments
Post a Comment