471,585 Members | 1,585 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,585 software developers and data experts.

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

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

Jul 19 '05 #1
8 3925
Mylinux wrote:
[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.

--
Phlip
Jul 19 '05 #2
[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 - cp******@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);
}
}


Jul 19 '05 #3
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.
Jul 19 '05 #4
> void main(void)

:/
Jul 19 '05 #5

SenderX <xx*@xxx.xxx> wrote in message
news:6f4gb.504684$cF.180114@rwcrnsc53...
void main(void)
:/

[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.

Jul 19 '05 #6
Jay
Mylinux wrote:
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?

Jul 19 '05 #7
Mylinux wrote:
<snip>

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

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.

Jul 19 '05 #8
"Mylinux" <my*****@My.com> wrote in message news:<bl*********@imsp212.netvigator.com>...
[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
Jul 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by vbMental | last post: by
5 posts views Thread by blackg | last post: by
6 posts views Thread by VMI | last post: by
reply views Thread by Anwar ali | last post: by

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.