Connecting Tech Pros Worldwide Forums | Help | Site Map

gcc test5.c test5

Mylinux
Guest
 
Posts: n/a
#1: Jul 19 '05
root@home BLCD]# gcc test5.c test5
gcc: test5: No such file or directory
test5.c:9:17: dos.h: No such file or directory
test5.c: In function `main':
test5.c:21: warning: return type of `main' is not `int'
[root@home BLCD]#
I added this "/* in the left hand corner of the first line but I have the
above error.





what is happened. dos.h is found in the linux box.

/* LCD Module Software */
/* 17th May 1997 */
/* Copyright 1997 Craig Peacock */
/* WWW - http://www.senet.com.au/~cpeacock */
/* Email - cpeacock@senet.com.au */
/* */
/* Register Select must be connected to Select Printer (PIN 17) */
/* Enable must be connected to Strobe (PIN1) */
/* DATA 0:7 Connected to DATA 0:7 */

#include <dos.h>
#include <string.h>

#define PORTADDRESS 0x378 /* Enter Your Port Address Here */

#define DATA PORTADDRESS+0
#define STATUS PORTADDRESS+1
#define CONTROL PORTADDRESS+2

void main(void)
{
char string[] = {"Testing 1,2,3 "
"It' Works ! "};
char init[10];
int count;
int len;
init[0] = 0x0F; /* Init Display */
init[1] = 0x01; /* Clear Display */
init[2] = 0x38; /* Dual Line / 8 Bits */

outportb(CONTROL, inportb(CONTROL) & 0xDF); /* Reset Control Port - Make
sure Forward Direction */

outportb(CONTROL, inportb(CONTROL) | 0x08); /* Set Select Printer (Register
Select) */

for (count = 0; count <= 2; count++)
{
outportb(DATA, init[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe (Enable)*/
delay(20); /* Larger Delay for INIT */
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe (Enable)*/
delay(20); /* Larger Delay for INIT */
}

outportb(CONTROL, inportb(CONTROL) & 0xF7); /* Reset Select Printer
(Register Select) */

len = strlen(string);

for (count = 0; count < len; count++)
{
outportb(DATA, string[count]);
outportb(CONTROL,inportb(CONTROL) | 0x01); /* Set Strobe */
delay(2);
outportb(CONTROL,inportb(CONTROL) & 0xFE); /* Reset Strobe */
delay(2);
}
}







Noah Roberts
Guest
 
Posts: n/a
#2: Jul 19 '05

re: gcc test5.c test5


Mylinux wrote:[color=blue]
> root@home BLCD]# gcc test5.c test5
> gcc: test5: No such file or directory[/color]

gcc -o test5 test5.c
[color=blue]
> test5.c:9:17: dos.h: No such file or directory[/color]

Linux != DOS.
[color=blue]
> test5.c: In function `main':
> test5.c:21: warning: return type of `main' is not `int'
> [root@home BLCD]#
> I added this "/* in the left hand corner of the first line but I have the
> above error.[/color]

I have no idea what that means.
[color=blue]
> what is happened. dos.h is found in the linux box.[/color]

If indeed dos.h is on your *linux* computer you obviously need to let
gcc know where. Assuming it is in "/some/dir/dos.h" you need

gcc -I/some/dir -o test5 test5.c

I am betting there is no dos.h on your linux computer. If indeed there
is you will also need to supply the correct linker options and I have
absolutely no idea what those would be.

Try "man gcc" as a command as well, and as others have said your asking
here is erroneous on 2 counts: 1 - not a C++ question at all, but C, and
2- not a language question but a compiler question. Try
comp.os.linux.development.apps.

NR

Closed Thread