Ver Mensaje Individual
  #2 (permalink)  
Antiguo 28/02/2011, 05:29
amzhit
 
Fecha de Ingreso: febrero-2011
Mensajes: 4
Antigüedad: 13 años, 2 meses
Puntos: 0
Respuesta: problema a la hora de compilar c

Voy a poner el resto del código aquí. Estoy seguro que tengo errores super tontos que dañaran a los ojos de los mas experimentados, pero faciles de encontrar, xD
registrar_jugador.h

libmtp.c
Código c:
Ver original
  1. #include <stdio.h>
  2. #include <time.h>
  3. #include "libmtp.h"
  4.  
  5. void leer_fecha(char *fecha){
  6.   struct tm * fecha_hora; /* tm es un tipo estructurado definido en <time.h>
  7.                           que contiene cada campo de fecha y hora */
  8.   time_t segundos;
  9.   segundos = time(NULL); /* obtiene los segundos desde 1-1-1970 */
  10.   fecha_hora=localtime(&segundos); /* convierte los 'segundos' en la hora local */
  11.   sprintf(fecha,"%d%02d%02d",fecha_hora->tm_year+1900,fecha_hora->tm_mon+1,fecha_hora->tm_mday);
  12.   fecha[8]='\0';
  13.  
  14. }
  15.  
  16. void mostrar_error(int error){
  17.     switch (error){
  18.         case ALUMNO_NO_EXISTE: printf("El alumno no existe en la base de datos.\n"); break;
  19.         case ALUMNO_SANCIONADO: printf("El alumno esta sancionado.\n"); break;
  20.         case ALUMNO_INSCRITO:printf("El alumno esta ya inscrito.\n"); break;
  21.         case EQUIPO_NO_EXISTE:printf("El equipo no existe.\n"); break;
  22.         case DEMASIADO_ALUMNOS:printf("El m·ximo de alumnos por equipo es de 20.\n"); break;
  23.         case NO_FICHERO:printf("Imposible acceder al almacen de datos\n"); break;
  24.     }
  25.     printf("\n");
  26. }
  27.  
  28. void borrar_pantalla(){
  29.     int i;
  30.     for (i=0;i<=25;i++) printf("\n");
  31. }

libmtp.h
Código c:
Ver original
  1. /* Fichero LIBMTP.H
  2.    definiciÛn de
  3.    estructuras de datos y
  4.    cabeceras de los mÛdulos de librerÌa de acceso a los archivos*/
  5.  
  6.  
  7. /* Constantes */
  8.  
  9.  
  10. # define LONG_DIRECCION 50
  11. # define LONG_NIF 9
  12. # define LONG_NOMBRE 50
  13. # define LONG_NOMBRE_EQUIPO 30
  14. # define LONG_TELEFONO 15
  15. # define LONG_MOTIVOS 30
  16.  
  17.  
  18.  
  19. /* CÛdigos de Error */
  20.  
  21.  
  22. # define ALUMNO_NO_EXISTE 1
  23. # define ALUMNO_SANCIONADO 2
  24. # define ALUMNO_INSCRITO 3
  25. # define EQUIPO_NO_EXISTE 4
  26. # define DEMASIADO_ALUMNOS 5
  27. # define NO_FICHERO 6
  28.  
  29.  
  30.  
  31. /* Tipos estructurados */
  32.  
  33. //typedef struct {
  34.  
  35. //  char dni[LONG_NIF];
  36. //  char nombre[LONG_NOMBRE];
  37. //} Alumno;
  38.  
  39. typedef struct {
  40.    
  41.     char nombre[LONG_NOMBRE+1], nif[LONG_NIF+1];
  42.     char direccion[LONG_DIRECCION+1];
  43. } Reg_alumno;
  44.  
  45. typedef struct {
  46.    
  47.     char nombre_equipo[LONG_NOMBRE_EQUIPO+1], nif_delegado[LONG_NIF+1], telefono[LONG_TELEFONO+1];
  48.    
  49. } Reg_equipo;
  50.  
  51.  
  52. typedef struct {
  53.    
  54.     char nombre_equipo[LONG_NOMBRE_EQUIPO+1], nif_jugador[LONG_NIF+1];
  55. } Reg_equipo_jugador;
  56.  
  57.  
  58. typedef struct {
  59.    
  60.     int id;
  61.     char nif[LONG_NIF+1];
  62.     char motivos [LONG_MOTIVOS+1];
  63. } Reg_sancion;
  64.  
  65. /* Librerias proporcionadas */
  66.  
  67.  
  68. void mostrar_error(int);
  69. /* Entrada: cÛdigo de error
  70.  * Efectos: Visualiza por pantalla el mensaje de error correspondiente al cÛdigo
  71.  */
  72.  
  73. void borrar_pantalla();
  74. /* Entrada: ---
  75.    Salida: ---
  76.    Efectos: limpia la pantalla */

cluster.c
Código c:
Ver original
  1. /*
  2.  *  cluster.c
  3.  *  recuperacion
  4.  *
  5.  *  Created by AmZHiT on 26/02/11.
  6.  *  Copyright 2011 __MyCompanyName__. All rights reserved.
  7.  *
  8.  */
  9.  
  10. #include "cluster.h"
  11.  
  12. static Reg_alumno elArray[20];
  13. static int tam;
  14.  
  15. void inicializar_lista(){
  16.     tam=0;
  17.    
  18. }
  19.  
  20. void insertar(struct Reg_alumno r){
  21.     Strcpy(elArray[tam].nombre,r.nombre);
  22.     Strcpy(elArray[tam].nif,r.nif);
  23.     Strcpy(elArray[tam].direccion,r.direccion);
  24.     tam++;
  25. }
  26.  
  27. struct Reg_alumno recuperar(void){
  28.     if (tam>=0) {
  29.        
  30.    
  31.     return elArray[tam];
  32.     tam--;
  33.     }
  34.     else {
  35.         return 0;
  36.     }
  37.  
  38. }
  39.  
  40. void borrar(){
  41.     elArray[tam]=0;
  42.     for (int i=tam; i<elArray.length(); i++) {
  43.         elArray[i]=elArray[i+1];
  44.     }
  45.     tam--;
  46. }

cluster.h
Código c:
Ver original
  1. /*
  2.  *  cluster.h
  3.  *  recuperacion
  4.  *
  5.  *  Created by AmZHiT on 26/02/11.
  6.  *  Copyright 2011 __MyCompanyName__. All rights reserved.
  7.  *
  8.  */
  9. #include "libmtp.h"
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12.  
  13. void inicializar_lista();
  14.  
  15. void insertar(struct Reg_alumno r);
  16.  
  17.  struct Reg_alumno recuperar();
  18.  
  19.  
  20. void borrar();

Me dan muchos errores de compilación con los structs, en el código en si no me da ninguno.

También me da muchos errores en las funciones, tanto si son void como si ecesitan pasar datos de una u otra forma.

Si alguien se toma el tiempo de mirar el código, muchas gracias de antemano.