cs50 / libcs50

This is CS50's Library for C.
https://cs50.readthedocs.io/libraries/cs50/c/
GNU General Public License v3.0
1.74k stars 853 forks source link

MacOS Big Sur 11.1 - Apple Silicon M1 Macbook Air CS50 lib not working #235

Closed notkspr closed 3 years ago

notkspr commented 3 years ago

Undefined symbols for architecture arm64: "_get_float", referenced from: _main in cash-a0c998.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [cash] Error 1

Rubix982 commented 3 years ago

How are you compiling and running the code, exactly? This seems like a linking issue.

notkspr commented 3 years ago

My Code: mario.c `

include

include

int main(void) { int height; do { height = get_int("Height:"); } while (height < 1 || height > 8);

for (int line = 0; line < height;line++)
{
    for (int spaces = height- line; spaces>1; spaces--)
    {
        printf(" ");
    }

    for (int hashes = 0; hashes < line +1;hashes++)
    {
        printf("#");
    }
    printf("\n");
}

} `

Terminal: make mario

notkspr commented 3 years ago

@Rubix982 Thanks a lot! I solved it using clang -lcs50 -o cash cash.c

Rubix982 commented 3 years ago

@Kasper-Liu I completely forgot about this issue. :facepalm: Happy coding!