Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2022-01-15 13:54:58

erich
New member
Registered: 2022-01-13
Posts: 2

Resolved: Old style C declaration. IGNORED

Hello everyone!

[EDIT]: resolved (by Toxa! thanks!), I didn't declare the variables in the right place! Thanks!

I'm new here, the usual, interested in making gameboy games, have experience in coding but not the c language (a little rusty). Thank you all for this place existing. So I've been having an issue when compiling, it keeps giving me this error:

Code:

main.c:8: error 7: Old style C declaration. IGNORED 'pause'
main.c:22: error 101: too many parameters 
main.c:28: error 101: too many parameters
First line mainly, the other two are just when I call that function 'pause'.

The error message comes from SDCC but I'm in way over my head here, although you will see the code is very simple. I was actually doing the « GBDK Joypad Tutorial (program 2) » on this very website: link (and tweaking it to try & get rid of the delay function). I tried removing the for loop and put a while instead, same issue.

Here's the entire app:

Code:

#include <stdio.h> // include this file for the printf() function
#include <gb/gb.h> // include this file for Game Boy functions
#include <stdint.h> // Include this file to use std types such as uint8_t

uint8_t i;
uint8_t loops;

void pause(loops){
    
    for(i = 0; i < loops; ++i){
        wait_vbl_done();
    }
}

void main(void){

    while(1){

        printf("Please press A?\n");
        waitpad(J_A);
        printf("You pressed A!\n\n");
        pause(10);
        printf("Hold down LEFT?\n");
        waitpad(J_LEFT);
        printf("You're holding down LEFT!\n");
        waitpadup();
        printf("You've released LEFT!\n\n\n");
        pause(10);
    }
}

Anyone able to help in any way? Thanks in advance!

Last edited by nitro2k01 (2022-01-21 23:18:31)

Offline

 

#2 2022-01-21 14:21:57

bbbbbr
Member
Registered: 2019-03-04
Posts: 109

Re: Resolved: Old style C declaration. IGNORED

Parameters passed to a function need to have a [ype:

Code:

void pause(uint8_t loops) {

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson