Problems making my own headers files
Posted: Tue Dec 15, 2009 7:18 pm
Hi,
I’m new in the DS programming (but not new in C programming) and I’m trying to “port” some programs that I wrote in Borland C.
I created a “.h” file, and put it into include directory. This is the file code:
Then I created another file, called like the .h but with .c extension. This is the code:
Then I included my .h into my main code, I tried to compile it and this is the error that I got:
c:/NDS/Demo3/include/carta.h:15: error: expected ')' before '*' token
c:/NDS/Demo3/source/carta.c:3: error: expected ')' before '*' token
Could somebody help me with this? I’d google the error but all links get me to Linux kernel compiling issues.
P.S.: I put this code into the main file and everything works fine, but still I want to create headers files with structs and all stuff
I’m new in the DS programming (but not new in C programming) and I’m trying to “port” some programs that I wrote in Borland C.
I created a “.h” file, and put it into include directory. This is the file code:
Code: Select all
#ifndef _CARTA_H_
#define _CARTA_H_
#define CARTA_ANCHO 30
#define CARTA_ALTO 50
typedef struct {
int numero;
int valor;
int palo;
int x;
int y;
} tyCarta;
void dibujarCarta(u16* b, tyCarta* c);
#endif
Code: Select all
#include "carta.h"
void dibujarCarta(u16* bank, tyCarta* carta){
//Dibuja la carta en el banco pasado por parámetro
int i;
for(i = carta->x; i <= carta->x + CARTA_ANCHO; i++){
bank[i + carta->y * 256] = RGB15(31,31,31);
bank[i + (carta->y + CARTA_ALTO) * 256] = RGB15(31,31,31);
}
for(i = carta->y; i <= carta->y + CARTA_ALTO; i++){
bank[carta->x + i * 256] = RGB15(31,31,31);
bank[(carta->y + CARTA_ANCHO)+ i * 256] = RGB15(31,31,31);
}
}
c:/NDS/Demo3/include/carta.h:15: error: expected ')' before '*' token
c:/NDS/Demo3/source/carta.c:3: error: expected ')' before '*' token
Could somebody help me with this? I’d google the error but all links get me to Linux kernel compiling issues.
P.S.: I put this code into the main file and everything works fine, but still I want to create headers files with structs and all stuff