Problems when compiling in C ++

-2

Hi, I'm just learning something from C ++ and I downloaded Jetbrain's CLION before installing the mingw following a video, the reason is that I was following the course and trying to compile or execute it throws me an error that I do not know very well It seems that it tells me that there are two main but I do not know how to solve it and leave the doubt here I leave the image

    
asked by Vladimir Joel 17.12.2017 в 21:48
source

1 answer

1

You are defining the main function in 2 different files ( HolaMundo.cpp and TiposDatosBasicos.cpp ).

There can only be 1 function main per project.

What you can do is rename those functions and call them from main in another file.

// HolaMundo.cpp
int holaMundo() {
  cout<<"Hola mundo"<<endl;
  return 0;
}

// TiposDatosBasicos.cpp
int tiposBasicos() {
  int numero = 15;
  cout<<numero;
  return 0;
}

// Main.cpp
int main() {
  holaMundo();
  tiposBasicos();
}
    
answered by 17.12.2017 / 21:51
source