gcc (rh 9.0 ) I do not know how to correct the error...

M

Mylinux

program was taken from http://www.beyondlogic.org/parlcd/parlcd.htm

when compile under rh 9.0


I do not know how to correct this error.


can u help? there is dos.h in my linux box.


thanks.

[root@home BLCD]# gcc test5.c test5
gcc: test5: No such file or directory
test5.c:1: parse error before numeric constant
test5.c:9:17: dos.h: No such file or directory
In file included from test5.c:10:
/usr/include/string.h:39: parse error before "size_t"
/usr/include/string.h:42: parse error before "size_t"
/usr/include/string.h:51: parse error before "size_t"
/usr/include/string.h:58: parse error before "size_t"
/usr/include/string.h:61: parse error before "size_t"
/usr/include/string.h:65: parse error before "size_t"
/usr/include/string.h:86: parse error before "size_t"
/usr/include/string.h:93: parse error before "size_t"
/usr/include/string.h:99: parse error before "size_t"
/usr/include/string.h:106: parse error before "strxfrm"
/usr/include/string.h:107: parse error before "size_t"
/usr/include/string.h:176: parse error before "strcspn"
/usr/include/string.h:180: parse error before "strspn"
/usr/include/string.h:230: parse error before "strlen"
/usr/include/string.h:248: parse error before "size_t"
/usr/include/string.h:253: parse error before "size_t"
/usr/include/string.h:257: parse error before "size_t"
/usr/include/string.h:260: parse error before "size_t"
/usr/include/string.h:263: parse error before "size_t"
/usr/include/string.h:291: parse error before "size_t"
test5.c: In function `main':
test5.c:21: warning: return type of `main' is not `int'
[root@home BLCD]#
 
P

Phlip

Mylinux said:
[root@home BLCD]# gcc test5.c test5
gcc: test5: No such file or directory
test5.c:1: parse error before numeric constant

Unfortunately, you are not asking how C++ (the topic of one of your
newsgroups) works.

You are asking how gcc works - how to compile a C program with it, how to
direct it to included files, etc.

You must ask this question on a single newsgroup or mailing list that covers
gcc, for the best results.

(You also should attend to any Makefile or "configure" files that may have
come with this source.)

Use http://www.google.com and http://groups.google.com to find the best
forum for this question.
 
M

Mylinux

I have ohter Makefile.


basically there is gcc test5.c test


since there is only one single test5.c. I think I should to ask expert to
help me out.
 
M

Mylinux

[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]#


/* LCD Module Software */
/* 17th May 1997 */
/* Copyright 1997 Craig Peacock */
/* WWW - http://www.senet.com.au/~cpeacock */
/* Email - (e-mail address removed) */
/* */
/* 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);
}
}
 
M

Mylinux

SenderX said:


[lcd@home BLCD]$ gcc -g -c test5.c -o test5
test5.c:9:17: dos.h: No such file or directory
test5.c: In function `main':
test5.c:20: warning: return type of `main' is not `int'
[lcd@home BLCD]$

I have tried that too.
but the error is like the above.
 
J

Jay

Mylinux said:
program was taken from http://www.beyondlogic.org/parlcd/parlcd.htm

when compile under rh 9.0


I do not know how to correct this error.


can u help? there is dos.h in my linux box.


thanks.

[root@home BLCD]# gcc test5.c test5
gcc: test5: No such file or directory

Stupidity will never get you very far.
Don't you even read the error messages?

Or is there something inherently difficult about
interpreting what "No such file or directory" means?
 
K

Kevin Goodsell

Mylinux wrote:
<snip>

This is not topical in comp.lang.c++. Please remove it from the
cross-post list when replying. Thank you.

-Kevin
 
S

Shane Beasley

Mylinux said:
[root@home BLCD]# gcc test5.c test5

FWIW, this is a C++ newsgroup, not a C newsgroup. Of course your
problem has nothing to do with either C or C++...
gcc: test5: No such file or directory
test5.c:9:17: dos.h: No such file or directory

ISO C++ does not have a <dos.h> header, nor do most systems which are
not DOS (e.g., Red Hat).

The function outportb() is not part of C++. Rather, it's part of some
system-specific API. I'm guessing that this code was written to be
built under DOS, but you're now trying to build it under Red Hat. C++
cannot do what you need; you need to use Linux-specific functionality.
Consult a Linux newsgroup for more info on that.
test5.c: In function `main':
test5.c:21: warning: return type of `main' is not `int'

main() must have int as its return type, not void. (And in C, it must
also return a value, e.g., 0).

- Shane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top