Benutze derzeit einen alten GCC von 2002, Version: 3.2.2 (DevKit Advance R5 Beta 3). Habe folgenden Code (Auszüge):
main.c:
Code: Alles auswählen
/// ...
#include "ball.h"
#include "score.h"
#include "paddle.h"
int main ()
{
    ///...
    struct paddle cpu_paddle;
    cpu_paddle.x=225;
    cpu_paddle.y=20;
    cpu_paddle.dimensions.height=30;
    cpu_paddle.dimensions.width=5;
       
    /// ...
         
    while(1)
    {    
        /// ...
        intelligence(&bl, &cpu_paddle);
        /// ...
     }
}
Code: Alles auswählen
#ifndef GBA_PONG_BALL
#define GBA_PONG_BALL
/// ...
#include "paddle.h"
struct ball
{
    struct {
        float x, y;
    } speed;
    struct {
        char width, height;
    } dimensions;
    
    float x, y;
};
/// ...
void collision ( struct ball* bl, struct paddle* player, struct paddle* cpu);
/// ...
#endif
Code: Alles auswählen
#ifndef GBA_PONG_PADDLE
#define GBA_PONG_PADDLE
/// ...
#include "ball.h"
struct paddle
{
    struct
    {
        char width, height;
    } dimensions;
    
    char x, y;
};
void intelligence( struct ball* bl, struct paddle* cpu );
/// ...
#endif
Code: Alles auswählen
In file included from ../../adv/ball.h:12,
                 from ../../adv/main.c:4:
../../adv/paddle.h:31: warning: `struct ball' declared inside parameter list
../../adv/paddle.h:31: warning: its scope is only this definition or declaration, which is probably not what you want
../../adv/main.c: In function `main':
../../adv/main.c:51: warning: passing arg 1 of `intelligence' from incompatible pointer type
In file included from ../../adv/ball.h:12,
                 from ../../adv/ball.c:3:
../../adv/paddle.h:31: warning: `struct ball' declared inside parameter list
../../adv/paddle.h:31: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from ../../adv/paddle.h:19,
                 from ../../adv/paddle.c:1:
../../adv/ball.h:29: warning: `struct paddle' declared inside parameter list
../../adv/ball.h:29: warning: its scope is only this definition or declaration, which is probably not what you want
Edit: Das Forum verarbeitet b-Tags innerhalb von Code-Tags anscheinend nicht.
Nochmal Edit: Ich versuche mit folgendem Befehle den Code zu übersetzen:
Code: Alles auswählen
wine gcc.exe -o ../../adv/hello.elf ../../adv/main.c ../../adv/screen.c ../../adv/ball.c ../../adv/paddle.c -std=c99 -Wall -pedantic

