error: Ld returned 1 Exit status C++

Asked

Viewed 900 times

0

I wrote this code in C++ in Codeblocks with the Register Residents class, but this giving the error

error: Ld returned 1 Exit status

that I haven’t found anything that would help me on the internet. I don’t know how to program very well yet.

In one example, my teacher used this mode to "call the class" (I don’t know how to say, declare maybe?):

int main()
{
  Automovel p;
  p.CadastrarAutomovel();
  p.ImprimirAutomovel();
  system("pause");
}

and I didn’t understand why of the class name and then the "p" and then call the functions with "p." at the beginning. I’ve seen other examples but the lyrics were different.

my code:

#include <iostream>
#include <stdlib.h>
#include <conio.h>

using namespace std;

class Registrar_moradores
{
private:

    char nome[200][50];
    int telefone[200], npessoas[200],op,linha;

public:
  void cadastro() {

    do{
      cout<<"***CADASTRAMENTOS DOS MORADORES***"<<endl;
      cout <<"\nNome:";
      cin >>nome[linha];
      cout <<"\nNumero do seu telefone principal:";
      cin >>telefone[linha];
      cout<<"\nNumero de pessoas que moram em sua casa incluindo voce:";
      cin >>npessoas[linha];
      cout<<"\nCadastrar outra pessoa?\n1=Cadastrar\n2-Sair\nResposta:";
      cin>>op;
      linha++;
     }while (op==1);
  }
};

int main(){
  Registrar_moradores p;
  p.cadastro();
}
  • Welcome to the Stackoverflow in Portuguese. Do the [tour] to learn how the community, access [help] to get help on the site tools and to make good use of it.

  • Look, there must have been an error before that. It appears because its main does not return 0. Maybe because, of the two, one: an error happened, or because you did not put return 0. at the end of main

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.