sudo apt-get install curl-devel
sudo apt-get install libcurl-dev
(will install the default alternative)
OR
sudo apt-get install libcurl4-openssl-dev
(the OpenSSL variant)
OR
sudo apt-get install libcurl4-gnutls-dev
(the gnutls variant)
Answer from n.m.is-an-unemployed-ai-agent on Stack Overflowsudo apt-get install curl-devel
sudo apt-get install libcurl-dev
(will install the default alternative)
OR
sudo apt-get install libcurl4-openssl-dev
(the OpenSSL variant)
OR
sudo apt-get install libcurl4-gnutls-dev
(the gnutls variant)
To those who use centos and have stumbled upon this post :
$ yum install curl-devel
and when compiling your program example.cpp, link to the curl library:
$ g++ example.cpp -lcurl -o example
"-o example" creates the executable example instead of the default a.out.
The next line runs example:
$ ./example
r - Cannot install 'RCurl' (Rcurl.h:4:23: fatal error: curl/curl.h: No such file or directory) - Stack Overflow
installation of package ‘RCurl’ had non-zero exit status. Rcurl.h:4:23: fatal error: curl/curl.h: No such file or directory #include <curl/curl.h>
fatal error: curl/curl.h: No such file or directory
c++ - Getting error: fatal error: curl/curl.h: No such file or directory #include <curl/curl.h> - Stack Overflow
Whenever I try to run any program with that library (C++), it always ends up with that error. I was searching for a solution for about an hour, here too, but no answers.
Also yes I checked and I have that library installed on my pc. Version 8.4.0
Mingw is gcc for windows. Practically everything that applies to gcc applies to mingw.
It's better to use relative paths in your Makefile and with gnu make (which is part of mingw/msys) always use '/' as path separator. If you have to use absolute path like C:\dev\projects\mylib use it this way: C:/dev/projects/mylib.
Back to your curl: curl/curl.h is in C:\path\to\curl-7.76.1-win32-mingw\include\curl\curl.h so you need to add include directory to your gcc command line that points to the right directory, which is C:\path\to\curl-7.76.1-win32-mingw\include because you use "curl/curl.h". If you don't have it (that curl) installed system wide it's also better to use "curl/curl.h" in #include path than <curl/curl.h>.
So all you have to do is add -Ipath/to/curl-7.76.1-win32-mingw/include to your compile line, like:
g++ -O2 -Ipath/to/curl-7.76.1-win32-mingw/include -c -omain.o main.cpp
It can be done automatically in Makefile:
CXX = g++
CFLAGS += -O2
INCLUDES += -Ipath/to/curl-7.76.1-win32-mingw/include
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCLUDES) $*.cpp
You write:
g++ -I "C:\Program Files\Curl\curl-7.76.1-win32-mingw\include\curl"
try better:
g++ -I "C:\Program Files\Curl\curl-7.76.1-win32-mingw\include"
as you have written in the code sample:
#include <curl/curl.h>
or conserve the -I option as it was, and change your #include to:
#include <curl.h>
I sincerely hope this will help.
I have just installed RStudio and R 4.1.1 from the sites. I am able to successfully install.packages("curl") but when I try to install.packages("RCurl") I get the following error message. Any help would be appreciated.
I presume that 'curl' is installed appropriately considering I am able to load the library, but am unable to ascertain why RCurl will not install.
Note: I am a complete Novice to R, so I might be doing something wrong. I also tried using the 'Packages -> Install' option in the lower right quad of the screen.
R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
> install.packages("curl")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/curl_4.3.2.zip'
Content type 'application/zip' length 4322385 bytes (4.1 MB)
downloaded 4.1 MB
package ‘curl’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\rober\AppData\Local\Temp\RtmpQN3XxO\downloaded_packages
> library(curl)
Using libcurl 7.64.1 with Schannel
> install.packages("RCurl")
There is a binary version available but the source version is later:
binary source needs_compilation
RCurl 1.98-1.3 1.98-1.4 TRUE
installing the source package ‘RCurl’
trying URL 'https://cran.rstudio.com/src/contrib/RCurl_1.98-1.4.tar.gz'
Content type 'application/x-gzip' length 728818 bytes (711 KB)
downloaded 711 KB
* installing *source* package 'RCurl' ...
** package 'RCurl' successfully unpacked and MD5 sums checked
** using staged installation
** libs
*** arch - i386
"Z:/Applications/Software/rtools40/mingw32/bin/"gcc -I"Z:/Applications/Software/R-4.1.1/include" -DNDEBUG -I/include -DHAVE_LIBIDN_FIELD=1 -DHAVE_CURLOPT_URL=1 -DHAVE_CURLINFO_EFFECTIVE_URL=1 -DHAVE_CURLINFO_RESPONSE_CODE=1 -DHAVE_CURLINFO_TOTAL_TIME=1 -DHAVE_CURLINFO_NAMELOOKUP_TIME=1 -DHAVE_CURLINFO_CONNECT_TIME=1 -DHAVE_CURLINFO_PRETRANSFER_TIME=1 -DHAVE_CURLINFO_SIZE_UPLOAD=1 -DHAVE_CURLINFO_SIZE_DOWNLOAD=1 -DHAVE_CURLINFO_SPEED_DOWNLOAD=1 -DHAVE_CURLINFO_SPEED_UPLOAD=1 -DHAVE_CURLINFO_HEADER_SIZE=1 -DHAVE_CURLINFO_REQUEST_SIZE=1 -DHAVE_CURLINFO_SSL_VERIFYRESULT=1 -DHAVE_CURLINFO_FILETIME=1 -DHAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD=1 -DHAVE_CURLINFO_CONTENT_LENGTH_UPLOAD=1 -DHAVE_CURLINFO_STARTTRANSFER_TIME=1 -DHAVE_CURLINFO_CONTENT_TYPE=1 -DHAVE_CURLINFO_REDIRECT_TIME=1 -DHAVE_CURLINFO_REDIRECT_COUNT=1 -DHAVE_CURLINFO_PRIVATE=1 -DHAVE_CURLINFO_HTTP_CONNECTCODE=1 -DHAVE_CURLINFO_HTTPAUTH_AVAIL=1 -DHAVE_CURLINFO_PROXYAUTH_AVAIL=1 -DHAVE_CURLINFO_OS_ERRNO=1 -DHAVE_CURLINFO_NUM_CONNECTS=1 -DHAVE_CURLINFO_SSL_ENGINES=1 -DHAVE_CURLINFO_COOKIELIST=1 -DHAVE_CURLINFO_LASTSOCKET=1 -DHAVE_CURLINFO_FTP_ENTRY_PATH=1 -DHAVE_CURLINFO_REDIRECT_URL=1 -DHAVE_CURLINFO_PRIMARY_IP=1 -DHAVE_CURLINFO_APPCONNECT_TIME=1 -DHAVE_CURLINFO_CERTINFO=1 -DHAVE_CURLINFO_CONDITION_UNMET=1 -DHAVE_CURLOPT_KEYPASSWD=1 -DHAVE_CURLOPT_DIRLISTONLY=1 -DHAVE_CURLOPT_APPEND=1 -DHAVE_CURLOPT_KRBLEVEL=1 -DHAVE_CURLOPT_USE_SSL=1 -DHAVE_CURLOPT_TIMEOUT_MS=1 -DHAVE_CURLOPT_CONNECTTIMEOUT_MS=1 -DHAVE_CURLOPT_HTTP_TRANSFER_DECODING=1 -DHAVE_CURLOPT_HTTP_CONTENT_DECODING=1 -DHAVE_CURLOPT_NEW_FILE_PERMS=1 -DHAVE_CURLOPT_NEW_DIRECTORY_PERMS=1 -DHAVE_CURLOPT_POSTREDIR=1 -DHAVE_CURLOPT_OPENSOCKETFUNCTION=1 -DHAVE_CURLOPT_OPENSOCKETDATA=1 -DHAVE_CURLOPT_COPYPOSTFIELDS=1 -DHAVE_CURLOPT_PROXY_TRANSFER_MODE=1 -DHAVE_CURLOPT_SEEKFUNCTION=1 -DHAVE_CURLOPT_SEEKDATA=1 -DHAVE_CURLOPT_CRLFILE=1 -DHAVE_CURLOPT_ISSUERCERT=1 -DHAVE_CURLOPT_ADDRESS_SCOPE=1 -DHAVE_CURLOPT_CERTINFO=1 -DHAVE_CURLOPT_USERNAME=1 -DHAVE_CURLOPT_PASSWORD=1 -DHAVE_CURLOPT_PROXYUSERNAME=1 -DHAVE_CURLOPT_PROXYPASSWORD=1 -DHAVE_CURLOPT_SSH_HOST_PUBLIC_KEY_MD5=1 -DHAVE_CURLOPT_NOPROXY=1 -DHAVE_CURLOPT_TFTP_BLKSIZE=1 -DHAVE_CURLOPT_SOCKS5_GSSAPI_SERVICE=1 -DHAVE_CURLOPT_SOCKS5_GSSAPI_NEC=1 -DHAVE_CURLOPT_PROTOCOLS=1 -DHAVE_CURLOPT_REDIR_PROTOCOLS=1 -DHAVE_CURLOPT_SSH_AUTH_TYPES=1 -DHAVE_CURLOPT_SSH_PUBLIC_KEYFILE=1 -DHAVE_CURLOPT_SSH_PRIVATE_KEYFILE=1 -DHAVE_CURLOPT_FTP_SSL_CCC=1 -DHAVE_CURLOPT_COOKIELIST=1 -DHAVE_CURLOPT_IGNORE_CONTENT_LENGTH=1 -DHAVE_CURLOPT_FTP_SKIP_PASV_IP=1 -DHAVE_CURLOPT_FTP_FILEMETHOD=1 -DHAVE_CURLOPT_LOCALPORT=1 -DHAVE_CURLOPT_LOCALPORTRANGE=1 -DHAVE_CURLOPT_CONNECT_ONLY=1 -DHAVE_CURLOPT_CONV_FROM_NETWORK_FUNCTION=1 -DHAVE_CURLOPT_CONV_TO_NETWORK_FUNCTION=1 -DHAVE_CURLOPT_CONV_FROM_UTF8_FUNCTION=1 -DHAVE_CURLOPT_MAX_SEND_SPEED_LARGE=1 -DHAVE_CURLOPT_MAX_RECV_SPEED_LARGE=1 -DHAVE_CURLOPT_FTP_ALTERNATIVE_TO_USER=1 -DHAVE_CURLOPT_SOCKOPTFUNCTION=1 -DHAVE_CURLOPT_SOCKOPTDATA=1 -DHAVE_CURLOPT_SSL_SESSIONID_CACHE=1 -DHAVE_CURLOPT_WRITEDATA=1 -DCURL_STATICLIB -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
In file included from base64.c:1:
Rcurl.h:4:10: fatal error: curl/curl.h: No such file or directory
#include <curl/curl.h>
^~~~~~~~~~~~~
compilation terminated.
make: *** [Z:/Applications/Software/R-4.1.1/etc/i386/Makeconf:238: base64.o] Error 1
ERROR: compilation failed for package 'RCurl'
* removing 'Z:/Applications/Software/R-4.1.1/library/RCurl'
Warning in install.packages :
installation of package ‘RCurl’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\rober\AppData\Local\Temp\RtmpQN3XxO\downloaded_packages’
>As far as I know (at this date), curl is available from Windows 10 v1803 console (I tested and indeed it is). The detailed explanations are here. For the use of libcurl on windows 10, I could not really find resources
There is no curl precompiled package on other windows. You need to either build libcurl from the sources as explained from this excellent resource and here. I tested these resources and they work.
If you use Visual Studio, the resources also show how you configure Visual studio to use it in your programs but I you also have this on SO (I found this resource on SO: How do you properly install libcurl for use in visual studio 2017?)
I haven't used that API, but I have used C++ APIs with Visual Studio before, assuming that is your IDE. So i was looking at the tutorial suggested above: link
Basically you need to compile either Libcurl or curlcpp given that the API is written in C. The tutorial explains a method for each, but seems to me that the one suggested for Libcurl is easier, given that there's already a Visual Studio solution for it and you only need to do a double click and compile it (this is a guess, I haven't tried).
Then, once you have built the project, you'll get a folder with files, DLLs and LIB files. The tutorial only says to declare those directories in your project:
Add CURL_STATICLIB to the preprocessor definitions.
Add curl\include and curlcpp\include to the list of Additional Include Directories. (Make sure you include the correct relative paths.)
Add curl and curlcpp output folders, curl\build\lib\x86 and curlcpp\lib\x86\, to the Additional Library Directories.
Add the following static libraries to the list of Additional dependencies: libcurld.lib;curlcppd.lib;Crypt32.lib;ws2_32.lib;winmm.lib;wldap32.lib;
This mean, you need to open the Properties of your solution (Right click, Properties), and add the folders required to tell Visual Studio that you have header files outside the typical installation folders.
In the Properties page, Under Configuration Properties, you'll see a property called VC++ Include Directories, in the Include Directories option is where you have to add the paths for the curl\include and curlcpp\include to let VS know that you have headers there.
Navigate thru the Properties page and you'll find the option for all of those steps above, The Include Directory and Library Directory are under the VC++ Directories property, and the Additional Library Directory is under the Linker Properties.