Expected initializer before 'void'

I'm doing a school project and I got everything working exept this.
I keep getting 'Expected initializer before void' but I've checked it probably 50 times and I don't see how's that wrong.

1
2
3
4
5
6
7
8
#include "Hora.h"
#include <stdio.h>
void CargaHora(Hora &hor){
  printf("Ingresar la hora\n");
  scanf("%d",&hor.Hora);
  printf("Ingresar los minutos\n");
  scanf("%d",&hor.Minutos );}
  
Does a file containing only one line #include "Hora.h" compile cleanly?
Last edited on
Yes
Verify that there are no stray characters in any of the lines after the #include directives.
(scroll all the way to the right)
I re-wrote everything on that file and I get the same error.
I'm also getting the same error with this: (Expected initializer before 'typedef')
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "Auto.h"
#include "Camioneta.h"
#include "Matricula.h"
#include "Hora.h"

typedef struct{
    string depto;
    Matricula matt;
    long int ID;
    Hora dIngreso;
    boolean typeVehi;
    union{
        Auto au;
        Camioneta cam;}datoExtra;
        }Vehiculo;

Everything else compiles just fine.
Last edited on
Check the header files once again (especially Hora.h); make sure that a semicolon (at the end) is not missing.

If the problem persists, post the contents of your header files.
Topic archived. No new replies allowed.