Hi
I'm using the lcc compiler for win32. I tried compiling a program but
there's an error stating: "cpp: Can't open input file clrscr()"
I don't get it - I've included <tcconio.h>. (strange why they couldn't
have just left it as <conio.h>?):
#include <tcconio.h>
// code
----
Albert 13 3669
ohmigod.
you gave a header file that is non-standard.
Jabba's listening.
--
-- --
--
Wade Ward
"I put my pants on like any other 6: between four and a dozen failures."
{~._.~} The Naked Picture Poster from Down Under
`( Y )`
"Albert" <al*****************@gmail.comwrote in message
news:11**********************@o80g2000hse.googlegr oups.com...
Hi
I'm using the lcc compiler for win32. I tried compiling a program but
there's an error stating: "cpp: Can't open input file clrscr()"
I don't get it - I've included <tcconio.h>. (strange why they couldn't
have just left it as <conio.h>?):
#include <tcconio.h>
// code
----
Albert
Albert wrote:
Hi
I'm using the lcc compiler for win32. I tried compiling a program but
there's an error stating: "cpp: Can't open input file clrscr()"
I don't get it - I've included <tcconio.h>. (strange why they couldn't
have just left it as <conio.h>?):
#include <tcconio.h>
// code
----
Albert
You have a mixup. The tcconio.h is included but if the preprocessor
says:
"cpp: Can't open input file clrscr()"
it means that you have
#include "clrscren()"
somewhere, and evidently the preprocessor cvan't find it. Please
post your code and I will fix it, if possible.
jacob
jacob navia wrote, On 23/09/07 10:42:
Albert wrote:
>Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()"
I don't get it - I've included <tcconio.h>. (strange why they couldn't have just left it as <conio.h>?):
#include <tcconio.h>
<snip>
somewhere, and evidently the preprocessor cvan't find it. Please
post your code and I will fix it, if possible.
Since you know it is a non-standard function and a header specific to
your implementation could you not have included a redirection to the
correct group, comp.compilers.lcc?
To the OP, comp.compilers.lcc is the correct place to discuss things
specific to versions of lcc such as tcconio.h which is specific to
lcc-win32 as far as I know.
--
Flash Gordon
Flash Gordon wrote:
jacob navia wrote, On 23/09/07 10:42:
>Albert wrote:
>>Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()"
I don't get it - I've included <tcconio.h>. (strange why they couldn't have just left it as <conio.h>?):
#include <tcconio.h>
<snip>
>somewhere, and evidently the preprocessor cvan't find it. Please post your code and I will fix it, if possible.
Since you know it is a non-standard function and a header specific to
your implementation could you not have included a redirection to the
correct group, comp.compilers.lcc?
To the OP, comp.compilers.lcc is the correct place to discuss things
specific to versions of lcc such as tcconio.h which is specific to
lcc-win32 as far as I know.
This is not compiler specific. The header is found and included,
but somewhere the user has a syntax error in his file, what is on
topic here.
The error message is written by lcc-win32's c preprocessor when it
can't find a file. Somewhere then, that user has
#include "clrscr()"
in his code.
jacob navia wrote, On 23/09/07 13:25:
Flash Gordon wrote:
>jacob navia wrote, On 23/09/07 10:42:
>>Albert wrote: Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()"
I don't get it - I've included <tcconio.h>. (strange why they couldn't have just left it as <conio.h>?):
#include <tcconio.h>
<snip>
>>somewhere, and evidently the preprocessor cvan't find it. Please post your code and I will fix it, if possible.
Since you know it is a non-standard function and a header specific to your implementation could you not have included a redirection to the correct group, comp.compilers.lcc?
To the OP, comp.compilers.lcc is the correct place to discuss things specific to versions of lcc such as tcconio.h which is specific to lcc-win32 as far as I know.
This is not compiler specific. The header is found and included,
but somewhere the user has a syntax error in his file, what is on
topic here.
<snip>
Yes, that specific error is topical. However, since his code relies on a
non-standard header and non-standard functions posting it here without
first removing all that non-standard stuff for you to correct would not
be appropriate.
--
Flash Gordon
On 23 Sep, 18:02, Flash Gordon <s...@flash-gordon.me.ukwrote:
<hopefully snipped enough and correctly! sorry if not!>
>
Yes, that specific error is topical. However, since his code relies on a
non-standard header and non-standard functions posting it here without
first removing all that non-standard stuff for you to correct would not
be appropriate.
Hi Mr Gordon, or Saviour of the Universe (I covered them tonight at a
gig, sorry, couldn't help but slip in the reference),
Not sure I agree with you. At first, I too thought it was off topic -
any mention of conio makes me scroll down. But it appears it is
topical.
It seems odd that you berate Jacob, a responder, for lack of precision
in the OP's question. Or maybe not, given the general m.o. in this
group lately.
Doug
On Sep 23, 7:42 pm, jacob navia <ja...@jacob.remcomp.frwrote:
Albert wrote:
Hi
I'm using the lcc compiler for win32. I tried compiling a program but
there's an error stating: "cpp: Can't open input file clrscr()"
I don't get it - I've included <tcconio.h>. (strange why they couldn't
have just left it as <conio.h>?):
#include <tcconio.h>
// code
----
Albert
You have a mixup. The tcconio.h is included but if the preprocessor
says:
"cpp: Can't open input file clrscr()"
it means that you have
#include "clrscren()"
somewhere, and evidently the preprocessor cvan't find it. Please
post your code and I will fix it, if possible.
jacob
Here's the code: (it's not mine - i'm analysing how people make simple
games in C) (see, i found the code but when i compiled it with digital
mars compiler it didn't know of the gotoxy function - i googled for a
compiler whose library defined the gotoxy function - namely the lcc
compiler but that didn't compile - i found out in the help they
defined it not in the conio.h but in tcconio.h but now it says the
error which was my original question - sigh)
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <tcconio.h>
int x = 40, l, k = 2, z = 0, i, score = 0;
void gameover();
void game();
void top();
void shoot();
void gotoxy (int x, int y);
void main()
{
int ch;
clrscr();
printf("\n\t\t\t\tSHOOTING IN C");
printf("\n\t\t\t\t*************");
printf("\n\n\n1.NEW GAME\n2.INSTRUCTIONS\n3.QUIT");
printf("\n\n\n ENTER YOUR CHOICE:");
scanf("%d", &ch);
switch(ch)
{
case 1:
game();
break;
case 2:
clrscr();
printf("\n\t\t1. Press any key to start the game.");
printf("\n\t\t2. Use'n' for left and 'm' for right directions.");
printf("\n\t\t3. Press ENTER key for shooting");
printf("\n\t\t4. PRESS 'x' KEY for Exit");
printf("\n\n\n\t\t\t Don't Use any other keys");
getch();
main();
break;
case 3:
exit(1);
}
}
void game()
{
char n, c;
int k, y = 24;
clrscr();
i = 0;
n = (char)i;
clrscr();
gotoxy(12,25);
cprintf("\nUSE 'n' or 'm' For Moving and then press Enter for
shoot");
while(c!=120)
{
c = getch();
switch(c)
{
case 'n':
top();
gotoxy(x--, y);
shoot();
break;
case 'm':
top();
gotoxy(x++,y);
cprintf(" ");
shoot();
}
cprintf("%c ",n);
}
}
void top()
{
char n;
l = 254;
n = (char)l;
randomize();
gotoxy(rand()%75, k);
cprintf("%c", n);
}
void shoot()
{
int c,a;
c = getch();
if (c == 13)
{
cprintf("%c", 263);
for (a = 0; a <= k; a++)
{
gotoxy(x, a);
cprintf(" ");
}
score += 10;
gotoxy(1, 1);
cprintf("SCORE=%d", score);
gameover();
}
}
void gameover()
{
int b;
z = z + 1;
if(z >= 3)
{
k++;
z = 0;
}
if ( k20)
{
printf("\n\t\t\tGAME OVER");
sleep(3);
getch();
exit(0);
}
}
Doug wrote, On 24/09/07 00:24:
On 23 Sep, 18:02, Flash Gordon <s...@flash-gordon.me.ukwrote:
<hopefully snipped enough and correctly! sorry if not!>
>Yes, that specific error is topical. However, since his code relies on a non-standard header and non-standard functions posting it here without first removing all that non-standard stuff for you to correct would not be appropriate.
Hi Mr Gordon, or Saviour of the Universe (I covered them tonight at a
gig, sorry, couldn't help but slip in the reference),
You don't need to apologies for that, it is where I get my nick from.
Not sure I agree with you. At first, I too thought it was off topic -
any mention of conio makes me scroll down. But it appears it is
topical.
It seems odd that you berate Jacob, a responder, for lack of precision
in the OP's question. Or maybe not, given the general m.o. in this
group lately.
I judged from the original post that solving the OPs problem would
involve going in to how to use the non-standard header and its
functions, maybe how to use the compiler as well. Having seen the OPs
code, I stand by that judgement. It did have several *other* problems
with it, but nothing in C terms to cause the error.
Also note I was not berating Jacob for answering, just asking that as it
was obviously quickly going to go in to implementation specifics that
Jacob redirect to the appropriate place. Had Jacob answered and done a
redirection I would not have commented at all.
--
Flash Gordon
Albert wrote, On 24/09/07 00:55:
On Sep 23, 7:42 pm, jacob navia <ja...@jacob.remcomp.frwrote:
>Albert wrote:
>>Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why they couldn't have just left it as <conio.h>?): #include <tcconio.h> // code ---- Albert
You have a mixup. The tcconio.h is included but if the preprocessor says:
"cpp: Can't open input file clrscr()"
it means that you have #include "clrscren()"
somewhere, and evidently the preprocessor cvan't find it. Please post your code and I will fix it, if possible.
jacob
Here's the code: (it's not mine - i'm analysing how people make simple
games in C) (see, i found the code but when i compiled it with digital
mars compiler it didn't know of the gotoxy function - i googled for a
compiler whose library defined the gotoxy function - namely the lcc
compiler but that didn't compile - i found out in the help they
defined it not in the conio.h but in tcconio.h but now it says the
error which was my original question - sigh)
There is nothing in your code to cause the error you are reporting with
any sane implementation and I don't think that Jacob's compiler is so
bad as to produce that error for the code you have posted.
As I suggested, your problem is with the use of non-standard facilities,
tcconio.h and clrscr. For those comp.compilers.lcc or a DOS group would
be appropriate. I will, however, point out the problems with your C code
which you should fix anyway.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <tcconio.h>
int x = 40, l, k = 2, z = 0, i, score = 0;
These should not be at file scope. They should be local to the top level
function they are needed in and passed as parameters. Then people can
actually see what the coupling is between functions. Also, even on the
rare occasions when file scope (or global) variables are needed, use
meaningful names, not things like i, z, k etc.
void gameover();
void game();
void top();
void shoot();
void gotoxy (int x, int y);
void main()
The only return type for main specified by the standard is int. Why use
something non-portable that gives you no benefit?
int main(void)
Being explicit about no parameters is also a good habit.
{
int ch;
clrscr();
printf("\n\t\t\t\tSHOOTING IN C");
printf("\n\t\t\t\t*************");
printf("\n\n\n1.NEW GAME\n2.INSTRUCTIONS\n3.QUIT");
printf("\n\n\n ENTER YOUR CHOICE:");
Without flushing the output or ending it with a newline the user might
not get to see your prompt in time.
scanf("%d", &ch);
IF you are going to use scanf, check the return value. It is there for a
good reason. Better would be using fgets to get the line and then
processing it after. With fgets you also have to check the return value,
but it is far easier to use correctly.
switch(ch)
{
case 1:
game();
break;
case 2:
clrscr();
printf("\n\t\t1. Press any key to start the game.");
printf("\n\t\t2. Use'n' for left and 'm' for right directions.");
printf("\n\t\t3. Press ENTER key for shooting");
printf("\n\t\t4. PRESS 'x' KEY for Exit");
printf("\n\n\n\t\t\t Don't Use any other keys");
getch();
getch is a non-standard function.
main();
Why on earth call main recursively rather than using a simple loop? This
entire menu system needs to be properly reviewed.
break;
case 3:
exit(1);
This is a non-portable exit value. The only portable values are 0,
EXIT_SUCCESS and EXIT_FAILURE, the latter two being defined in stdlib.h
and 0 being another way of saying "success".
}
You can reach here, so you should return a value.
}
void game()
{
char n, c;
int k, y = 24;
k isn't used.
clrscr();
i = 0;
n = (char)i;
The cast is pointless.
clrscr();
gotoxy(12,25);
cprintf("\nUSE 'n' or 'm' For Moving and then press Enter for
shoot");
while(c!=120)
{
c = getch();
switch(c)
{
case 'n':
top();
gotoxy(x--, y);
shoot();
break;
case 'm':
top();
gotoxy(x++,y);
cprintf(" ");
shoot();
}
cprintf("%c ",n);
}
}
void top()
{
char n;
l = 254;
n = (char)l;
This cast is not needed.
randomize();
randomize is not standard. To seed the random number generator use
srand((unsigned int)time(NULL));
<snip>
These are all serious points which need fixing, but none of them is the
cause of your immediate problem. How to use tcconio.h and the
non-standard functions is something that belongs else where.
--
Flash Gordon
On Sep 24, 5:22 pm, Flash Gordon <s...@flash-gordon.me.ukwrote:
Albert wrote, On 24/09/07 00:55:
On Sep 23, 7:42 pm, jacob navia <ja...@jacob.remcomp.frwrote:
Albert wrote: Hi I'm using the lcc compiler for win32. I tried compiling a program but there's an error stating: "cpp: Can't open input file clrscr()" I don't get it - I've included <tcconio.h>. (strange why they couldn't have just left it as <conio.h>?): #include <tcconio.h> // code ---- Albert
You have a mixup. The tcconio.h is included but if the preprocessor
says:
"cpp: Can't open input file clrscr()"
it means that you have
#include "clrscren()"
somewhere, and evidently the preprocessor cvan't find it. Please
post your code and I will fix it, if possible.
jacob
Here's the code: (it's not mine - i'm analysing how people make simple
games in C) (see, i found the code but when i compiled it with digital
mars compiler it didn't know of the gotoxy function - i googled for a
compiler whose library defined the gotoxy function - namely the lcc
compiler but that didn't compile - i found out in the help they
defined it not in the conio.h but in tcconio.h but now it says the
error which was my original question - sigh)
There is nothing in your code to cause the error you are reporting with
any sane implementation and I don't think that Jacob's compiler is so
bad as to produce that error for the code you have posted.
As I suggested, your problem is with the use of non-standard facilities,
tcconio.h and clrscr. For those comp.compilers.lcc or a DOS group would
be appropriate. I will, however, point out the problems with your C code
which you should fix anyway.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <tcconio.h>
int x = 40, l, k = 2, z = 0, i, score = 0;
These should not be at file scope. They should be local to the top level
function they are needed in and passed as parameters. Then people can
actually see what the coupling is between functions. Also, even on the
rare occasions when file scope (or global) variables are needed, use
meaningful names, not things like i, z, k etc.
void gameover();
void game();
void top();
void shoot();
void gotoxy (int x, int y);
void main()
The only return type for main specified by the standard is int. Why use
something non-portable that gives you no benefit?
int main(void)
Being explicit about no parameters is also a good habit.
{
int ch;
clrscr();
printf("\n\t\t\t\tSHOOTING IN C");
printf("\n\t\t\t\t*************");
printf("\n\n\n1.NEW GAME\n2.INSTRUCTIONS\n3.QUIT");
printf("\n\n\n ENTER YOUR CHOICE:");
Without flushing the output or ending it with a newline the user might
not get to see your prompt in time.
scanf("%d", &ch);
IF you are going to use scanf, check the return value. It is there for a
good reason. Better would be using fgets to get the line and then
processing it after. With fgets you also have to check the return value,
but it is far easier to use correctly.
switch(ch)
{
case 1:
game();
break;
case 2:
clrscr();
printf("\n\t\t1. Press any key to start the game.");
printf("\n\t\t2. Use'n' for left and 'm' for right directions.");
printf("\n\t\t3. Press ENTER key for shooting");
printf("\n\t\t4. PRESS 'x' KEY for Exit");
printf("\n\n\n\t\t\t Don't Use any other keys");
getch();
getch is a non-standard function.
main();
Why on earth call main recursively rather than using a simple loop? This
entire menu system needs to be properly reviewed.
break;
case 3:
exit(1);
This is a non-portable exit value. The only portable values are 0,
EXIT_SUCCESS and EXIT_FAILURE, the latter two being defined in stdlib.h
and 0 being another way of saying "success".
}
You can reach here, so you should return a value.
}
void game()
{
char n, c;
int k, y = 24;
k isn't used.
clrscr();
i = 0;
n = (char)i;
The cast is pointless.
clrscr();
gotoxy(12,25);
cprintf("\nUSE 'n' or 'm' For Moving and then press Enter for
shoot");
while(c!=120)
{
c = getch();
switch(c)
{
case 'n':
top();
gotoxy(x--, y);
shoot();
break;
case 'm':
top();
gotoxy(x++,y);
cprintf(" ");
shoot();
}
cprintf("%c ",n);
}
}
void top()
{
char n;
l = 254;
n = (char)l;
This cast is not needed.
randomize();
randomize is not standard. To seed the random number generator use
srand((unsigned int)time(NULL));
<snip>
These are all serious points which need fixing, but none of them is the
cause of your immediate problem. How to use tcconio.h and the
non-standard functions is something that belongs else where.
--
Flash Gordon
Thanks - Fine, I'll post it to that other group; few points - this
isn't my code and I don't get it myself; it doesn't have any comments
to any of those 'magic variables'; i can see now that a lot of
functions are non-standard (this would imply that this made especially
compiler-specific); the game isn't great because i don't really get
that either; i agree - in the c programming language by k&r it states
to avoid global variables; hey now - why don't you try download the
lcc compiler - i'm sure i downloaded the latest one and see if you can
compile this;
This last point is to most people - sorry, i didn't know that there
were groups dedicated to specific compilers.
Thanks again
Albert
Albert wrote:
>
.... snip ...
>
Thanks - Fine, I'll post it to that other group; few points - this
isn't my code and I don't get it myself; it doesn't have any comments
to any of those 'magic variables'; i can see now that a lot of
functions are non-standard (this would imply that this made especially
compiler-specific); the game isn't great because i don't really get
that either; i agree - in the c programming language by k&r it states
to avoid global variables; hey now - why don't you try download the
lcc compiler - i'm sure i downloaded the latest one and see if you can
compile this;
The point is that it isn't C code. We deal with the standardized
language here, and can't handle myriad off-beat extensions dreamed
up by whomever. Thus you need to go to a newsgroup inhabited by
those dreamer-uppers, or (better) eliminate the non-standard
features.
The lcc writer (Jacob Navia) inhabits this group, and has a
somewhat tarnished reputation here. However the group
"comp.compilers.lcc" exists, and handles lcc-win32. Jacob Navia
also appears there.
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
--
Posted via a free Usenet account from http://www.teranews.com
CBFalconer <cb********@yahoo.comwrites:
The lcc writer (Jacob Navia) inhabits this group, and has a
somewhat tarnished reputation here.
There is an old saying about those in glass houses. You should look it
up.
>
--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Albert wrote, On 24/09/07 09:33:
<snip>
to avoid global variables; hey now - why don't you try download the
lcc compiler - i'm sure i downloaded the latest one and see if you can
compile this;
For several reasons, one of which is that this machine runs Linux not
Windows.
This last point is to most people - sorry, i didn't know that there
were groups dedicated to specific compilers.
As far as I am concerned you are still welcome here when it comes to C
questions. Valid C questions include "is <somethingstandard C?" The
answer might be that it is not, but that is not a problem to me.
--
Flash Gordon This discussion thread is closed Replies have been disabled for this discussion. Similar topics
reply
views
Thread by Jagdeesh |
last post: by
|
16 posts
views
Thread by pj |
last post: by
|
4 posts
views
Thread by sebastien NO Maraux SPAM |
last post: by
|
2 posts
views
Thread by Darren Martz |
last post: by
|
1 post
views
Thread by Rune Jorgensen (DDS) |
last post: by
|
2 posts
views
Thread by f rom |
last post: by
|
2 posts
views
Thread by stevenruiz |
last post: by
| |
reply
views
Thread by dami.gupta |
last post: by
| | | | | | | | | | |