Tom, I need your help with errors in TC

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
beyondsociety

Tom, I need your help with errors in TC

Post by beyondsociety »

[attachment deleted by admin]
Tom

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

Post by Tom »

try includeing conio.h....
beyondsociety

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

Post 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?
Tom

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

Post by Tom »

you can't use getchar.

you have to use getch
beyondsociety

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

Post by beyondsociety »

[attachment deleted by admin]
Tom

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

Post by Tom »

[attachment deleted by admin]
Tom

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

Post by Tom »

[attachment deleted by admin]
Schol-R-LEA

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

Post 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).
beyondsociety

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

Post by beyondsociety »

[attachment deleted by admin]
Post Reply