Post Reply 
HELP on compiling BASIC C Source Code
05-05-2014, 07:42 PM
Post: #9
RE: HELP on compiling BASIC C Source Code
(05-03-2014 07:26 PM)Alvaro Wrote:  Hi,
I found the "C" Source Code of "My-BASIC" (https://code.google.com/p/my-basic/) and I am trying to compile it with HPGCC 2.0 Win.
The HPGCC compiler is giving following errors:

> "dmake" main.hp
arm-elf-gcc -mtune=arm920t -mcpu=arm920t -mlittle-endian -fomit-frame-pointer -msoft-float -Wall -Os -pipe -mthumb-interwork -mthumb -IH:\HPGCC-2.0-native-win32-SP2/include -I.. -c main.c -o main.o
main.c:36:27: error: unistd.h: No such file or directory
main.c:38:20: error: assert.h: No such file or directory
unistd.h declares a bunch of unix functions. assert.h declares the assert() function. What really matters are the implicitly declared functions that follow. You might want to google "<function> man page" to get a description of what each function does. Then you can reimplement, replace it or ignore it as you see fit.
Quote:main.c: In function '_destroy_code':
main.c:78: warning: implicit declaration of function 'assert'
the assert() function is used to assert something that is always true. if the argument to assert() is false then it aborts the program. You can probably reimplement this.
Quote:main.c: In function '_load_file':
main.c:151: warning: implicit declaration of function 'ftell'
ftell() returns the current position within an open file. You can use the return value as an argument to fseek() to go back to that place in the file.
Quote:main.c: In function '_clear_screen':
main.c:227: warning: implicit declaration of function 'system'
system() takes a string and more-or-less execute the string as though it had been typed on the keyboard. Since this is inside _clear_screen(), I suspect that you can just reimplement clear_screen() using the hpgcc graphics functions.
Quote:main.c: In function '_list_program':
main.c:240: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type
main.c:241: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type
main.c: In function '_edit_program':
main.c:272: warning: passing argument 1 of 'atoi' discards qualifiers from pointer target type
These can probably be ignored. Check the type of the argument to atoi(). It is supposed to be a char*.
Quote:main.c: In function '_kill_program':
main.c:316: warning: implicit declaration of function 'unlink'
unlink() removes a file.
Quote:main.c: In function '_do_line':
main.c:362: warning: implicit declaration of function 'strcasecmp'
make: *** [main.o] Error 1
strcasecmp() compares two strings without regard to upper/lower case. I'm surprised that this isn't in the hpgcc libs already. Maybe you just need to find the right header file to include to get this.

Hope this helps,
Dave
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HELP on compiling BASIC C Source Code - David Hayden - 05-05-2014 07:42 PM



User(s) browsing this thread: 1 Guest(s)