I'm just starting out, using VS code as my IDE. Here is my code
#include <stdio.h>
//here were are setting up a function
//meow(void) means it takes no arguments
//void at the beginning is specifying the return type
void meow(void)
{
printf("meow\n");
}
int main(void)
{
for (int i = 0; i <3 ; i++)
{
meow();
}
}
And here is the error I receive after typing make meow
in the terminal :
clang -fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow meow.c -lcrypt -lcs50 -lm -o meow
ld: library not found for -lcrypt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [meow] Error 1
Importantly, in accordance with this source from the cs50 course https://cs50.readthedocs.io/libraries/cs50/c/, my .bashrc file looks like this:
export LIBRARY_PATH=/usr/local/lib
export C_INCLUDE_PATH=/usr/local/include
export LD_LIBRARY_PATH=/usr/local/lib
And for what it's worth, my .bash_profile looks like this:
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/cam/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/cam/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/cam/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/cam/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export CC="clang"
export CFLAGS="-fsanitize=signed-integer-overflow -fsanitize=undefined -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow"
export LDLIBS="-lcrypt -lcs50 -lm"
Also, the program will compile if I run clang meow.c
. That creates an object called a.out
and then if I run ./a.out
the meow program will run. So I guess the problem the problem is with make. Perhaps it's not finding the clang compiler for some reason?
Or perhaps this has something to do with not having the -lcrypt
library? I've tried to find more info on this library, but couldn't find anything available. Not literature on the web or anything to download and install. Perhaps I'm overlooking something.
Any help on this error would be appreciated.