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 |
|---|---|---|---|---|
| 0 | 12311 | en | https://en.ans.wiki/6858/how-to-solve-this-error-undefined-reference-to-strlcpy-while-compiling-in-c | 7 |