0


The code for pset 3 fiftenn is running fine when i enter different values of d and is getting completed as well.
But on check 50 getting the following set of errors.
Any help here would be appreciated as m stuck on this for a few hours.

Attaching the code (Pastebin Link) as well

https://pastebin.com/7prdFJgG

enter image description here

1 Answer 1

1
  1. If you get a result link, maybe click it to gain further information.
  2. If it doesn't compile on the server, it might not do so on your computer. It would have been helpful if you had used make locally.

Output for make on my machine indicates you should use get_int instead of GetInt:

~/workspace/pset3/fifteen/ $ make
clang -ggdb3 -O0 -std=c11 -Wall -Werror -o fifteen fifteen.c -lcs50 -lm
fifteen.c:107:20: error: 'GetInt' is deprecated [-Werror,-Wdeprecated-declarations]
        int tile = GetInt();
                   ^
/usr/include/cs50.h:122:5: note: 'GetInt' has been explicitly marked deprecated here
int GetInt(void) __attribute__((deprecated));
    ^
1 error generated.
make: *** [fifteen] Error 1

[edit] Even though you use old code that still uses GetInt, this should not happen in check50 as the server uses a flag to ignore deprecation warnings in compiling. I just tried to check50 my own code, and it worked even though it contains GetInt.

Found a seemingly unrelated bug in won, a possible condition is if(board[i][j] != (j + 1) + (i * d) && board[i][j] != 0) with one ! removed and && instead of ||.

4
  • Now that I've been able to open the link check50 gave you (would have been nice to not have to type it from an image), I wonder why the code won't compile, as the compiler uses -Wno-deprecated-declarations. With that switch, the file compiles for me. Maybe you forgot to save?
    – Blauelf
    Aug 21, 2017 at 13:54
  • Thanks a lot , it worked with the change you suggested in the if statement in won. Although the code works now but m unable to understand the reason behind the error "Can't check until a frown turns upside down" which came earlier Aug 22, 2017 at 6:18
  • The "Can't check until a frown turns upside down" is reasonable, given that the compile step failed. The compile error... Without the actual error message, it's hard to guess. I assume it might have something to do with you using ! on an int, which turns the number into a boolean, and then comparing to an int. That might make little sense, but is valid C code, so the compiler should digest it happily.
    – Blauelf
    Aug 22, 2017 at 6:57
  • Thanks a lot, i also think its because of this because of the ! used before an int. Aug 22, 2017 at 10:09

You must log in to answer this question.

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