undefined symbol for architecture x86_64 in compiling C program [duplicate]
You need to compile both the source files together to generate the binary. use
gcc demo_use.c libhello.c -o test
Otherwise, the definition of hello()
function will be absent. So, at linking time, linker will throw undefined symbol
error.