Page 1 of 1

Tom, I need your help with errors in TC

Posted: Wed Oct 16, 2002 5:57 pm
by beyondsociety
[attachment deleted by admin]

Re:Tom, I need your help with errors in TC

Posted: Thu Oct 17, 2002 10:40 am
by Tom
try includeing conio.h....

Re:Tom, I need your help with errors in TC

Posted: Fri Oct 18, 2002 10:54 am
by beyondsociety
Hey tom, I included the conio.h file and ran it. It still gave me the same error. So I decided to check the conio.h header file to see if the function getchar was in there. I noticed that it is not in there at all. But there is a getchar function in stdio.h but its a fgetchar and not just getchar.

Any suggestions?

Re:Tom, I need your help with errors in TC

Posted: Fri Oct 18, 2002 11:31 am
by Tom
you can't use getchar.

you have to use getch

Re:Tom, I need your help with errors in TC

Posted: Fri Oct 18, 2002 2:35 pm
by beyondsociety
[attachment deleted by admin]

Re:Tom, I need your help with errors in TC

Posted: Fri Oct 18, 2002 6:00 pm
by Tom
[attachment deleted by admin]

Re:Tom, I need your help with errors in TC

Posted: Fri Oct 18, 2002 6:00 pm
by Tom
[attachment deleted by admin]

Re:Tom, I need your help with errors in TC

Posted: Sun Oct 20, 2002 3:15 pm
by Schol-R-LEA
Actually, there's a typo in the code, tha you have attached here:

[tt]
int tokentype; /* The type and value of the current token */
char token [MAX_TOKEN + 1];
char look /* Our lookahead character */

/* Heres where Im having the problem.
If a add a semi colon to the end of void GetLook(),
It gives me two errors instead of one. If I add a extra
void in the () after GetLook, it does nothing.

Error Line (25): Declaration Syntax Error */

/* GetLook simply loads look with the next character */
void GetLook() /* This line */
{
look = getchar();
}
[/tt]

If you look at the highlighted code, you'll notice a missing semicolon. Thus, when you eliminate the line breaks and comments, the result is the following declaration:

Code: Select all

char look void GetLook()             /* This line */
{
look = getchar();
}
This probably is the declaration syntax problem you initially reported. It's the kind of thing that leave you tearing your hair out staring at it before you find it. I once spend three weeks trying to find what turned out to be a similiar bug (an incorrectly closed comment, in that case).

Re:Tom, I need your help with errors in TC

Posted: Mon Oct 21, 2002 10:26 am
by beyondsociety
[attachment deleted by admin]