I dont know why but if I include curl_easy_init()
in my code, all my console output will be omitted. no matter it is executed before or after the function is called.
This code below would output "Helo" as expected.
#include <iostream>
#include <curl/curl.h>
using namespace std;
int main(){
std::cout<<"Helo"<<std::endl;
CURL *asd;
// asd = curl_easy_init();
return 0;
}
But this wouldn't output ANYTHING on console.
#include <iostream>
#include <curl/curl.h>
using namespace std;
int main(){
std::cout<<"Helo"<<std::endl;
CURL *asd;
asd = curl_easy_init();
return 0;
}
The console looks like this when I ran these 2 snippet.
PS C:\Users\Administrator\Desktop\Test> cd "c:\Users\Administrator\Desktop\Test\" ; if ($?) { g++ -std=c++17 test2.cpp sqlite3.o -lcurl -DCURL_STATICLIB -o test2 } ; if ($?) { .\test2 }
Helo
PS C:\Users\Administrator\Desktop\Test> cd "c:\Users\Administrator\Desktop\Test\" ; if ($?) { g++ -std=c++17 test2.cpp sqlite3.o -lcurl -DCURL_STATICLIB -o test2 } ; if ($?) { .\test2 }
I am using vscode with code runner and I downloaded my compiler with mingw. I downloaded "curl-8.2.0_1-win32-mingw" and copied the files in "lib" and "include" into the files in mingw accordingly. i dont know what i did wrong! can anyone help me??
edit:
PS C:\Users\Administrator\Desktop\Test> cd "c:\Users\Administrator\Desktop\Test\" ; if ($?) { g++ -Wall -Wextra -pedantic -O2 -std=c++17 test2.cpp sqlite3.o -lcurl -DCURL_STATICLIB -o test2 } ; if ($?) { .\test2 }
test2.cpp: In function 'int main()':
test2.cpp:7:11: warning: variable 'asd' set but not used [-Wunused-but-set-variable]
CURL *asd;
^~~