0

Everytime i compile my program, it appears this error: 1d returned 1 exit status. And my code doesn't even have a exit status. i put #include "oraculo.h" because i created it and activate_oracle() is from there.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "oraculo.h"

void limpaBuff()
{ // limpa se o valor for invalido
    int n;
    while((n=getchar())!=EOF && n!='\n');
}

int main(int argc, char ** argv)
{
    int tamanho=-1, cor=-1, repeticao=-1;
    do
    {
        printf("Tamanho d   a chave secreta[4 a 8]:");
        scanf("%d", &tamanho);
        printf("Numero de cores[6 a 12]:");
        scanf("%d", &cor);
        printf("Coloque 1 para repeticao e 0 para nao repeticao:");
        scanf("%d", &repeticao);
        limpaBuff();
    }
    while(tamanho<4 || tamanho>8 || cor<6 || cor>12 || (repeticao!=0 && repeticao!=1));
    activate_oracle(tamanho, cor, repeticao);

}

  • Look at the **full** output and you'll see you have an "undefined reference" error as shown in the duplicate. – dbush Apr 30 '19 at 14:39
  • i got undefined reference now, but i included my oraculo.h. why is that? i also put oraculo.h and oraculo.o in the same place as my project – Silverhelp Apr 30 '19 at 14:49
  • you need to link the resulting object files together. When you have both `main.o` and `oraculo.o` you need to link them aginst each other. you can do this by calling `gcc` only with the object files: `gcc main.o oraculo.o -o out` – Yastanub Apr 30 '19 at 14:58
  • Thank you. Is there any way to call gcc on windows terminal? Or do i have to get the virtual box and move to Linux so i can do that? – Silverhelp Apr 30 '19 at 15:27

1 Answers1

0

Add return 0; to the end of your main() function because that's where exit codes should be put. Also, if your code does happen to error it will return with an exit code of 1.

Aplet123
  • 33,825
  • 1
  • 29
  • 55