Tetris en 19 líneas de código C

  1. #13   Con gcc 4.x no compila en Debian:

    tetris.c:1: warning: data definition has no type or storage class
    tetris.c:1: warning: cast from pointer to integer of different size
    tetris.c:1: error: initializer element is not constant
    tetris.c:1: error: (near initialization for ‘v[0]’)
    tetris.c: In function ‘u’:
    tetris.c:6: warning: incompatible implicit declaration of built-in function ‘printf’
    tetris.c: In function ‘main’:
    tetris.c:16: warning: incompatible implicit declaration of built-in function ‘printf’
    tetris.c:18: warning: incompatible implicit declaration of built-in function ‘fprintf’
    tetris.c:19: warning: passing argument 1 of ‘fprintf’ makes pointer from integer without a cast
    tetris.c:19: note: expected ‘void *’ but argument is of type ‘int’

    ¿Tiene alguien a mano una máquina con gcc 3?
    10  votos: 2   link
    el 05-08-2010 06:20 UTC por quique quique
     twitter  facebook  tuenti  
  1. #14   #13 En RedHat EL5 con gcc 4.1.2 tampoco funciona:

    [root@mypc ~]# gcc -o tetris tetris.c
    tetris.c:1: aviso: la definición de datos no tiene tipo o clase de almacenamiento
    tetris.c:1: error: el elemento inicializador no es constante
    tetris.c:1: error: (cerca de la inicialización de ‘v[0]’)
    tetris.c: En la función ‘u’:
    tetris.c:6: aviso: declaración implícita incompatible de la función interna ‘printf’
    tetris.c: En la función ‘main’:
    tetris.c:16: aviso: declaración implícita incompatible de la función interna ‘printf’
    tetris.c:18: aviso: declaración implícita incompatible de la función interna ‘fprintf’
    tetris.c:19: aviso: el paso del argumento 1 de ‘fprintf’ crea un puntero desde un entero sin una conversión
    7  votos: 2   link
    el 05-08-2010 06:23 UTC por jsianes jsianes
  2. #19   #13 y #14

    A mi me ha compilado.

    (gcc version 4.3.4 (Debian 4.3.4-6))

    vortex:/tmp# gcc tetrix.c -o tetrix
    tetrix.c:1: warning: data definition has no type or storage class
    tetrix.c: In function ‘u’:
    tetrix.c:1: warning: incompatible implicit declaration of built-in function ‘printf’
    tetrix.c: In function ‘main’:
    tetrix.c:1: warning: incompatible implicit declaration of built-in function ‘printf’
    tetrix.c:1: warning: incompatible implicit declaration of built-in function ‘fprintf’
    tetrix.c:1: warning: passing argument 1 of ‘fprintf’ makes pointer from integer without a cast
    14  votos: 1   link
    el 05-08-2010 06:42 UTC por nemeS nemeS
  3. #21   #13 Creo que le falta una línea al inicio:
    include <stdio.h>
    13  votos: 0   link
    el 05-08-2010 06:47 UTC por cubaman cubaman
  4. #45   #13 Es por que, si os fijáis, en el fuente no hay ni un solo include.
    6  votos: 0   link
    el 05-08-2010 08:38 UTC por cavefish cavefish
  5. #48   #13 GCC 4.4.4 en Fedora 13, compila perfectamente.
    10  votos: 0   link
    el 05-08-2010 09:43 UTC por johnny32 johnny32
  6. #57   #13 #14 increible, Linux users que no saben compilar un programa :-|
    0  votos: 1   link
    el 05-08-2010 16:29 UTC por alexis_web alexis_web
comentarios cerrados

menéame