id returned 1 Exit status C code, help

Asked

Viewed 33,086 times

-5

my code is giving error id returned 1 and I have no idea why giving this error I did everything right, someone could help me?

  #include <stdio.h>
  #include <stdlib.h>

  int main ()
  {
    float CP,LP,PP,LA,AA,PL,PC,FP,AT,QA,AAZ;
    Printf ("\nApresente o comprimento,Largura e profundidade: ");
    scanf ("%f, %f, %f", &CP, &LP, &PP);
    printf ("\napresente largura e altura do azulejo: ");
    scanf ("%f, %f", &LA, &AA);
    {
        PL = 2*CP*PP;
        PC = 2*LP*PP;
        FP = CP*LP;
        AT = PL+PC+FP;
        AAZ = LA*AA;
    }
    {
        QA = (AT / AAZ)*1.05;
    }
      printf("\nA quantidade de azulejos para o revestimento da piscina e: %f", QA);
     system ("PAUSE");
  }
  • Hello Matheus. Please edit your question to include an explanation of what your question is.

  • yes I’ve edited ,sorry.

  • No http://ideone.com/aLP1dC works fine. I passed the variables to double (there is no reason to use float) and took the system("PAUSE");

  • 4

    Wave is Printf is printf.

  • 1

    The function is missing main return some value too, no?

  • 3

    id? Won’t be ld (Linker)?

  • I think it is the error id. GCC here returned status 1 when I run this code.

  • Homework? I saw another question with the almost equal code posted about 2h before that.

  • was right there not to edit and cause another problem I created another question, but I managed to solve the problem.

Show 4 more comments

1 answer

4


I have compiled your code on my machine and the error message is quite clear:

/tmp/ccaHCVvZ.o: In function `main':
a.c:(.text+0x13): undefined reference to `Printf'
collect2: error: ld returned 1 exit status

He can’t find a definition for the function Printf. You want to printf, nay?

Enabling warnings with the build flag -Wall (always use) error gets even better:

a.c: In function ‘main’:
a.c:7:5: warning: implicit declaration of function ‘Printf’ [-Wimplicit-function-declaration]
     Printf ("\nApresente o comprimento,Largura e profundidade: ");
     ^
a.c:23:3: warning: control reaches end of non-void function [-Wreturn-type]
   }
   ^
/tmp/ccJtM9Fv.o: In function `main':
a.c:(.text+0x13): undefined reference to `Printf'
collect2: error: ld returned 1 exit status

Here is pointed out (literally) the function that does not exist. Moreover a second warning is charged: you set the function main to return int, but it’s not returning anything! Add a return 0; in the end.

Browser other questions tagged

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