7 ms·
To compile it you'll need to tell it to link to libcurl, e.g. with -lcurl on gcc: curl https://ifconfig.me --libcurl ip_fetcher.c # Output: your ip ad
by undecisive 3y ago
To compile it you'll need to tell it to link to libcurl, e.g. with -lcurl on gcc:
curl https://ifconfig.me --libcurl ip_fetcher.c
# Output: your ip address, and a file ip_fetcher.c
gcc -o ip_fetcher ip_fetcher.c -lcurl
# Output: no errors, just a file ip_fetcher
./ip_fetcher
# Output: your ip address
(I'm sure most people are saying "no duh" right now, but I'm probably not the only one on here who doesn't write C code every day!)
- chungy 3y agoIt might be even easier this way: $ curl https://ifconfig.me --libcurl ip_fetcher.c $ make LDFLAGS=-lcurl ip_fetcher $ ./ip_fetcher (I just find make a heck of a lot easier than running direct cc commands)
- undecisive 3y agoTIL - I have never used make without a Makefile! Thank you!