473,659 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error compiling file using lcc compiler

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

Sep 23 '07 #1
13 3801
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.com wrote in message
news:11******** **************@ o80g2000hse.goo glegroups.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

Sep 23 '07 #2
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
Sep 23 '07 #3
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
Sep 23 '07 #4
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.
Sep 23 '07 #5
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
Sep 23 '07 #6
On 23 Sep, 18:02, Flash Gordon <s...@flash-gordon.me.ukwro te:

<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

Sep 23 '07 #7
On Sep 23, 7:42 pm, jacob navia <ja...@jacob.re mcomp.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.INSTRUC TIONS\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()%7 5, 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);
}
}

Sep 23 '07 #8
Doug wrote, On 24/09/07 00:24:
On 23 Sep, 18:02, Flash Gordon <s...@flash-gordon.me.ukwro te:

<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
Sep 24 '07 #9
Albert wrote, On 24/09/07 00:55:
On Sep 23, 7:42 pm, jacob navia <ja...@jacob.re mcomp.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.INSTRUC TIONS\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
Sep 24 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3670
by: Jagdeesh | last post by:
Hai Colleagues, I am using Tomcat 4.1.24 and JDK 1.4.0_03 in my winXP machine. I've transferred a set of folders(containing jsp files) into tomcat's webapps directory(to /webapps/bob , /webapps/sue) and i have added the folders bob, sue in my server.xml(in the context path). When i am trying to run jsp files from my browser, it works fine. But, the following jsp files reports some exceptions which is quite hard to understand. Here is...
16
2846
by: pj | last post by:
(Was originally, probably wrongly, posted to the vc subgroup.) (This doesn't appear to be a c# problem, but a problem with a bug in the Visual Studio c# compiler, but, any help will be welcome...) Oh, I forgot to list the error messages; I would be delighted if someone could explain how to deduce which line number in which file is the one that the VC compiler cannot handle. Actually I'm using C#, but the only post I could find about...
4
1982
by: sebastien NO Maraux SPAM | last post by:
I am using Ghost Lib 4.0, which is SDK for Phantom haptic device. this lib does not compile under .net, seemingly because of a union of this type : union A { union A* aList; char b; };
2
2240
by: Darren Martz | last post by:
Compiler: msvc 7.1 AppType: console OS: WinXP Pro I now get this "Internal Compiler Error mscl.cpp line 2701" message when I build a specific project and cannot figure out why. It was compiling fine, then I changed a resource text value and it started complaining. I changed the code but it didn't matter, it now continually complains.
1
2104
by: Rune Jorgensen (DDS) | last post by:
I use the C++ compiler with Visual Studio .NET 2003. OS is XP SP2. Our projects include many large 3rd party C++ include files. I have installed the hotfix mentioned in MSDN KB article 837437. It helped for a while, but now the problem as popped up again. /Zm option does not help. The funny thing about it, is that if you compile many files in one go, the first file will compile ok, the rest will fail. So you can solve the problem by...
2
5318
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
2
1973
by: stevenruiz | last post by:
Hi Everyone, The Strings.h has the function Get_Line which is defined and the error is shown below: Strings.h: void get_line( istream & );
1
3764
by: kvarada | last post by:
Hello Experts, I am building my application on WinNT.4.0_i386_MSVC.7.1 platform. When I build the application on a stand alone machine, it builds fine. But when I build the same application from a linux box using rsh it gives me the errors below Microsoft (R) Development Environment Version 7.10.3077. Copyright (C) Microsoft Corp 1984-2001. All rights reserved. ------ Build started: Project: SigComp, Configuration: Release Win32 ------...
0
1601
by: dami.gupta | last post by:
I am building a chm file using sandcastle and am following instructions on https://blogs.msdn.com/sandcastle/archive/2006/07/29/682398.aspx I am following all the commands which are proceeding kind of ok, until I get to hhc output\test.hhp
0
8335
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8747
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6179
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4335
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.