I am trying to read a key hit and then stop a code. In C.
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
bool starting()
{
char c;
if (kbhit())
{
c=getch();
if (c=="S"||c=="s")
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
int main()
{
while(!starting)
{
printf("line 1");
delay(100);
}
return 0;
}
Without stdbool.h
, it says errors like
syntax error: identifier 'starting',
syntax error: ";"
syntax error: ")"
'starting': undeclared identifier
With stdbool.h, it says file not found. My compiler is the one that comes with Visual Studio 2010.
Any suggestion how to remove this? How can I still use a function that returns a boolean value?
ADDED sorry! for the short comment added. resolved mostly. Thanks all
Added More Errors: After Compiling: it reads:
filename.obj unresolved external symbol _delay referenced in function _main.
What should I do?