Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12201

FAcing error cannot open source file "curl/curl.h"

$
0
0
#include <stdio.h>#include <curl/curl.h>int main(void) {    CURL *curl;    CURLcode res;    // Initialize libcurl    curl_global_init(CURL_GLOBAL_DEFAULT);    // Create a curl handle    curl = curl_easy_init();    if(curl) {        // Set the URL for the POST request        curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/api/endpoint");        // Set the POST data        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "key1=value1&key2=value2");        // Perform the HTTP POST request        res = curl_easy_perform(curl);        // Check for errors        if(res != CURLE_OK)            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));        // Cleanup        curl_easy_cleanup(curl);    }    // Cleanup libcurl    curl_global_cleanup();    return 0;}

This code is running on linux terminal via command:gcc main.c -o main -lcurl./mainBut not running on vs code`

I was expecting that code will run on vscode as well just like the terminal so that i could upload it on Esp32 from there


Viewing all articles
Browse latest Browse all 12201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>