I'm having an issue with CS50's check50
utility. My week 3 Plurality code is working, but when I submit it to be checked I get these results:
Results for cs50/problems/2020/x/plurality generated by check50 v3.0.10
:) plurality.c exists
:( plurality compiles
code failed to compile
:| vote returns true when given name of first candidate
can't check until a frown turns upside down
:| vote returns true when given name of middle candidate
can't check until a frown turns upside down
:| vote returns true when given name of last candidate
can't check until a frown turns upside down
:| vote returns false when given name of invalid candidate
can't check until a frown turns upside down
:| vote produces correct counts when all votes are zero
etc...
Except, the code does compile. I have tested it with multiple compilers on my own machine (GCC, clang) with multiple -pedantic
flag levels; I have tested it in CS50's IDE by specifying a compiler directly (also GCC) and this produces a working executable; and of course the make plurality
command, which also produces working output. The executables also work, obviously, but this shouldn't matter; the results complain that the code doesn't compile, which of course it obviously does (on 2 different plaforms, for multiple compilers).
What is going on here? If there is something obvious I've missed, then why is my code still compiling and running fine outside of check50
?
Here are my #includes
and headers:
#include <cs50.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#define MAX_NAME_LENGTH 128
#define CHR_VOTE_COUNT 5 // 1 character, max. votes of 9., check buffer, plus null & newline character
#define MAX_VOTES 9
I can paste in other code if necessary, but it isn't particularly interesting.
Thanks for any help!
#define
s violate this imperative from the spec "You should not modify anything else in plurality.c other than the implementations of the vote and print_winner functions (and the inclusion of additional header files, if you’d like)."tideman.c
file, I just write everything from scratch. I was more interested in getting the code performing properly than checking through all the catches. Will look out in the future.