I get a for my unkown error when I try to compile dictionary.c. The problem lies in my implementaionof check. Here is my code:

int charNumber(char c);

typedef struct node
    // bool Alphabet
    bool is_word;
    struct node* children [27];

node* root;
 * Returns true if word is in dictionary else false.
bool check(const char* word)
    node* index = root;

    //iterate over words and check if mispelled
    for(int i = 0; i<strlen(word); i++)
        if(index -> children[charNumber(word[i])] == NULL)
        return false;
        index = index -> children[charNumber(word[i])];

    //check for end of word
    if(index ->is_word)
    return true;
    return false;

and here is the error:

~/workspace/pset5 $ make
clang -ggdb3 -O0 -Qunused-arguments -std=c11 -Wall -Werror -o speller         speller.o     dictionary.o 
dictionary.o: In function `check':
/home/ubuntu/workspace/pset5/dictionary.c:39: undefined reference to         `charNumber'

/home/ubuntu/workspace/pset5/dictionary.c:41: undefined reference to `charNumber' clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [speller] Error 1

Anyone that can make any sense of it? Thank you!!

1 Answer 1


Best guess is that you have defined the signature for charNumber(), but the actual function doesn't appear in the file. When the compiler goes looking for it, it can't find the actual function.

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

You must log in to answer this question.

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