How to solve this error « undefined reference to 'strlcpy' » while compiling in C?
The error undefined reference to 'strlcpy'
appears when compiling a C code using the library bsd/string.h
. You need to link the library as well as including the header. Add the -lbsd
option to your command line while compiling:
gcc -o prog prog.c -lbsd
Note that the ordering is important. If you put the the source file after the -lbsd
option, it may not work.
The error undefined reference to 'strlcpy'
appears when compiling a C code using the library bsd/string.h
. You need to link the library as well as including the header. Add the -lbsd
option to your command line while compiling:
gcc -o prog prog.c -lbsd
Note that the ordering is important. If you put the the source file after the -lbsd
option, it may not work.
The error undefined reference to `strlcpy'
appears when compiling a C code using the library bsd/string.h
. You need to link the library as well as including the header. Add the -lbsd
option to your command line while compiling:
gcc -o prog prog.c -lbsd
Note that the ordering is important. If you put the the source file after the -lbsd
option, it may not work.
# | ID | Query | URL | Count |
---|