-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory functions not working. #18
Comments
Which compiler (and version) are you using? Also on what platform? |
I'm currently running it under Ubuntu 16.04, 64-bit AMD. -> % lcc -v
lcc $Id: lcc.c,v 1.6 2001/10/28 18:38:13 michaelh Exp $
-> % sdcc -v
SDCC : gbz80/z80 2.3.1/gbdk-2.96a (Feb 14 2017) (UNIX) I wrote a test program to showcase what I'm experiencing, maybe I'm just an idiot and I'm missing something huge. #include <stdio.h> // For debug.
#include <stdlib.h> // Shouldn't malloc be included here?
#include <gb/gb.h>
#include <gb/malloc.h> // Doesn't throw an error finding the header file.
// But nothing gets defined.
// Stupid simple struct.
typedef struct _object {
UBYTE x, y;
BYTE vx, vy;
} object;
void main() {
object *obj = (object *)malloc(sizeof(object)); // Implicit delcaration?
printf("%d", sizeof(obj));
} If i compile it with lcc $Id: lcc.c,v 1.6 2001/10/28 18:38:13 michaelh Exp $
/opt/gbdk/bin/sdcpp -Wall -lang-c++ -DSDCC=1 -DSDCC_PORT=gbz80 -DSDCC_PLAT=gb -DSDCC_MODEL_SMALL -DGB=1 -DGAMEBOY=1 -DINT_16_BITS -D__LCC__ -I/opt/gbdk/include main.c /tmp/lcc45600.i
/opt/gbdk/bin/sdcc -mgbz80 --noinvariant --noinduction --nostdinc --nostdlib --model-small --c1mode /tmp/lcc45600.i /tmp/lcc45601.asm
main.c(15):warning *** function 'malloc' implicit declaration
main.c(15):error *** too many parameters
main.c(15):warning *** function 'malloc' implicit declaration
main.c(16):error *** code not generated for 'main' due to previous errors
lcc: fatal error in /opt/gbdk/bin/sdcc
rm /tmp/lcc45601.asm /tmp/lcc45600.i Hope that's enough info. |
Thanks for the example. Yes it seems that the I am not really familiar with the code but I could not find usage of There is a newer version of gbdk called gbdk-n but the |
Yeah, I realized this after a dig through the source code not long after I sent this issue. Thank you for getting back in touch though! |
Upon compiling all of the memory allocation, etc. functions aren't defined.
I'm not entirely sure why, but this is what I get in the console.
Is this just a weird bug on my end?
The text was updated successfully, but these errors were encountered: