0

This is my code, I know the curly brackets should come before you start coding but it gives the same error 'expected identifier' in every debug I tried. I have seen your other post to others as well but still can't figure it out. Thanks

#include <cs50.h>

int main(void)

{
    printf ("Minutes\n");
    int Minutes = get_int();
}

Error message

db3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadow    integer.c  -lcrypt -lcs50 -lm -o integer
1 error generated.
make: *** [integer] Error 1
db3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadow    integer.c  -lcrypt -lcs50 -lm -o integer
integer.c:5:1: error: expected identifier or '('
make: *** [integer] Error 1
clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wshadowinteger.c:7:9: error: unused variable 'Minutes'
      [-Werror,-Wunused-variable]
    int Minutes = get_int();
        ^
2 errors generated.
make: *** [integer] Error 1
0

the compiler in the IDE is very "strict", it is configured to warn us with an error if we declare a variable and do nothing with it, you declare the Minutes variable but do nothing, hence the [-Werror, -Wunused- variable], the solution is to perform any operation with it, for example what we are asked for the specifications of the problem

2
  • I think i understand, how about the first error error: expected identifier or '('
    – do8240
    Oct 24 '17 at 1:09
  • en su código no hay más error, although you should include the header file <stdio.h>
    – MARS
    Oct 24 '17 at 11:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .