#149540 - Cave Johnson - Mon Jan 21, 2008 9:55 pm
Why do i keep getting this error? It seems be saying that im missing a main() function in my code, but unless im totally not understanding a major aspect of programming, dont i have one? Heres the first snippet of my main.cpp file:
#include <nds.h>
#include "colors_slot1.h"
init main() {
iriqInit();
iriqSet (IRQ_VBLANK, 0);
lcdMainOnBottom();
initVideo();
initBackgrounds();
displaycolors_slot1();
return 0;
}
What am i doing wrong? Thanks.
#149544 - DiscoStew - Mon Jan 21, 2008 10:02 pm
change "init main() {" to "int main() {"
EDIT:
Also, you should make sure that other functions match the correct names. The "Iriq" stuff is most likely "Irq" unless you've made your own functions that do the same thing.
_________________
DS - It's all about DiscoStew
#149549 - Cave Johnson - Mon Jan 21, 2008 10:18 pm
Thank you that fixed that code, but in this code to make a grit file of a png image, i get the same error, why here? Thanks.
#include <nds.h>
#include <stdio.h>
#include "colors_slot1.h"
int getSize(uint8 *source, uint16 *dest, uint32 arg) {
return *(uint32*)source;
}
uint8 readByte(uint8 *source) {
return *source;
}
TDecompressionStream colors_slot1_decomp = {
getSize,
NULL,
readByte
};
int main(void) {
irqInit();
irqEnable(IRQ_VBLANK);
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetMainBanks( VRAM_A_MAIN_BG_0x06000000, VRAM_B_LCD,
VRAM_C_SUB_BG , VRAM_D_LCD);
SUB_BG0_CR = BG_MAP_BASE(31);
BG_PALETTE_SUB[255] = RGB15(31,31,31);
consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
iprintf("\n\n\tWelcome To\n");
iprintf("\tProject Satan\n");
iprintf("\t(Yes Its a Futurama Reference)");
BG3_CR = BG_BMP16_256x256;
BG3_XDX = 1 << 8;
BG3_XDY = 0;
BG3_YDX = 0;
BG3_YDY = 1 << 8;
BG3_CX = 0;
BG3_CY = 0;
swiDecompressLZSSVram((void*)colors_slot1Bitmap, BG_GFX, 0, &colors_slot1_decomp);
while(1) swiWaitForVBlank();
return 0;
}
#149552 - DiscoStew - Mon Jan 21, 2008 10:45 pm
I can't spot the problem myself, but what you probably should do is start with that small example you had, and build it up slowly from there. Perhaps the problem will pop up when something gets added.
_________________
DS - It's all about DiscoStew
#149554 - Cave Johnson - Mon Jan 21, 2008 10:54 pm
Hmmmm, i guess il have to do that, but do you know any good .grit tutorials or examples i can follow and work with, or is their an easier way to get a background and sprite into a game? Thanks.
#149555 - DiscoStew - Mon Jan 21, 2008 11:01 pm
I've honestly never touched anything involving .grit files. :(
_________________
DS - It's all about DiscoStew
#149560 - Cave Johnson - Mon Jan 21, 2008 11:20 pm
they are going to be the death of me! is their anyway to put pictures and sprites in there without using grit files, but something easier and less confusing?
#149563 - Cave Johnson - Mon Jan 21, 2008 11:57 pm
Ok now im getting the same error with a basic hello world, so what is wrong with this code? Thanks.
#include <nds.h>
#include <stdio.h>
int main(void)
{
videoSetMode(0);
videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE);
vramSetBankC(VRAM_C_SUB_BG);
SUB_BG0_CR = BG_MAP_BASE(31);
BG_PALETTE_SUB[255] = RGB15(31,31,31);
consoleInitDefault((u16*)SCREEN_BASE_BLOCK_SUB(31), (u16*)CHAR_BASE_BLOCK_SUB(0), 16);
printf("\n\n\tHello World!\n");
while(1) {
touchPosition touchXY = touchReadXY();
printf("\x1b[10;0H");
printf("Touch x = %d \n", touchXY.px);
printf("Touch y = %d \n", touchXY.py);
}
return 0;
}
#149569 - Cearn - Tue Jan 22, 2008 1:23 am
It's not the grit part that's the problem. For some reason, your sources just aren't compiled. If they were, you'd have seen compiler errors for "init main" and such instead of linker errors. Check the SOURCES variable in the makefile. In all likelihood the folder with your sources isn't in it. It might help if you posted the makefile.
#149571 - Cave Johnson - Tue Jan 22, 2008 1:48 am
Thanks so much to everyone for putting up with my nooby problems, and hizzah its fixed! Cearn your right it was in my makefile!