[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SUPER OT] no me compila y no encuentro el fallo



Buenas. El siguiente trozo de programa no me compila y no encuentro que
carajo es lo que pasa.

Me da estos errores :

-----------------------------------------------------------------------
vuelo.cpp:15: error: type specifier omitted for parameter `ifstream'
vuelo.cpp:15: error: error sintáctico before `&' token
vuelo.cpp:25: error: type specifier omitted for parameter `ifstream'
vuelo.cpp:25: error: error sintáctico before `&' token
vuelo.cpp: En function `void SepCodVuelo(...)':
vuelo.cpp:32: error: `fichSep' undeclared (first use this function)
vuelo.cpp:32: error: (Each undeclared identifier is reported only once
for each   function it appears in.)
vuelo.cpp:40: error: `codVueloSep' undeclared (first use this function)
vuelo.cpp: En function `void MVuelo::LeerFich(char*,
MVuelo::TReservas&)': vuelo.cpp:48: error: `ifstream' undeclared (first
use this function) vuelo.cpp:48: error: error sintáctico before `;'
token vuelo.cpp:54: error: `indVuelo' undeclared (first use this
function) vuelo.cpp:55: error: `fichRes' undeclared (first use this
function) vuelo.cpp:55: error: `ios' undeclared (first use this
function) vuelo.cpp:55: error: error sintáctico before `::' token
-----------------------------------------------------------------------


Notas:
El error "indVuelo no declarado" no me supone ningún problema
corregirlos, los que me joden son los referentes a ficheros.
Las otras partes del programa funcionan bien, y solo me da error este
codigo.
La libreria fstream no me falla en otros programas que tengo, es decir
que no me falta ni nada de eso.
Estoy usando el dev-c++ de windows pero me da los mismos errores con el
g++ bajo linux.

Gracias y un saludo.


-----------------------------------------------------------------------
#include <iostream> #include <cstdlib>
#include "cola.h"
#include "lista.h"
#include "cadena.h"
#include "vuelo.h"
#include <fstream>

using namespace MCadena;
using namespace Mlista;
using namespace MCola;
using namespace MVuelo;

void InicVuelo(TVuelo &vueloAInic);
void SepCodVuelo(TCadena &codVueloSep, ifstream &fichSep);

void InicVuelo(TVuelo &vueloAInic)
{
   vueloAInic.Codigo[0] = FINCAD;
   vueloAInic.Capacidad = 0;
   vueloAInic.Pasajeros = CrearLista();
   vueloAInic.CEspera = CrearCola();
}

void SepCodVuelo(TCadena &codVueloSep, ifstream &fichSep)
{
   const char ESPACIO = ' ';
   unsigned int i;
   TCadena temp;
   
   i = 0;
   temp[i] = fichSep.get();
   
   while (temp[i] != ESPACIO)
   {
      i++;
      temp[i] = fichSep.get();
   }
   temp[i] = FINCAD;
   CopiaCadena(temp, codVueloSep);
}
   
namespace MVuelo
{

void LeerFich(TCadena FichReservas, TReservas &reserv)
{
   ifstream fichRes;
   TVuelo vueloIns;
   unsigned int i, numVuelo;
   unsigned int numPasajeros;
   TCadena nomPasajero;
   
   indVuelo = 0;
   fichRes.open(FichReservas, ios::in);
   
   if ( fichRes.good() )
   {
      InicVuelo(vueloIns);
      SepCodVuelo(vueloIns.Codigo); //lectura adelantada
      while ( !fichRes.eof() )
      {
         fichRes >> vueloIns.Capacidad;
         fichRes >> numPasajeros;
         for (i=0;i<vueloIns.Capacidad;i++)
         {
            fichRes.getline(nomPasajero, MAXCAD, ENTER);
            MeterLista(vueloIns.Pasajeros, nomPasajero);
         }
         for (i=0;i<(numPasajeros-vueloIns.Capacidad);i++)
         {
            fichRes.getline(nomPasajero, MAXCAD, ENTER);
            MeterCola(vueloIns.CEspera, nomPasajero);
         }
         reserv.Vuelos[indVuelo] = vueloIns;
         indVuelo++;
         InicVuelo(vueloIns);
      }
   }         
   fichRes.close();
}

}//fin namespace MVuelo
----------------------------------------------------------------------- 



Reply to: