So I'm trying to use curl.h in c++ my main.cpp is just hello world but with include curl/curl.h:
#include <iostream>
#include <curl/curl.h>
int main(){
std::cout<<"hello world!";
return 0;
}
my CMakeLists.txt looks like this:
add_executable(main)
target_sources(main PRIVATE main.cpp)
cmake_minimum_required(VERSION 3.15)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake CACHE STRING "Vcpkg toolchain file")
project(web_crawler)
find_package(libcurl-simple-https CONFIG REQUIRED)
I am new to both vcpkg and CMake and I am trying to learn it thats why it looks like this.
and my vcpkg.json is:
{
"name": "webcrawler",
"version-string": "latest",
"dependencies": [
"libcurl-simple-https"
]
}
cmake build seems to work fine and when i use make I'm getting this:
fatal error: curl/curl.h: No such file or directory
2 | #include <curl/curl.h>
| ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/main.dir/build.make:76: CMakeFiles/main.dir/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/main.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
As I already told I am new to both cmake and vcpkg so I have no idea what to do and couldn't find any similar post as most of them are about installing curl.
Wild guess here, but after this line:
Did you not forget to add the include directory for it? So the next line should be something like:
What I've done in other projects is:
You'll have to check the spelling and possibly the case since I'm not familiar with the name you used, "libcurl-simple-https".