libcpr / cpr

C++ Requests: Curl for People, a spiritual port of Python Requests.
https://docs.libcpr.org/
Other
6.29k stars 903 forks source link

Cannot open source file "cpr/cprver.h" #1064

Closed Zachdehooge closed 2 weeks ago

Zachdehooge commented 2 weeks ago

Description

I just initialized a new project in VSCODE. I am receiving this error and am unable to build the executable.

Example/How to Reproduce

  1. Make a CMakeLists.txt file with the following:
    
    cmake_minimum_required (VERSION 3.5) #Enter the CMAKE version 
    project (CHANGEME) #Project name
    add_executable(main main.cpp) #If the first or second param (the output name of the exec) is changed, ensure it is also changed in the build.sh file

include(FetchContent) FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) # Replace with your desired git commit from: https://github.com/libcpr/cpr/releases FetchContent_MakeAvailable(cpr)

target_link_libraries(main PRIVATE cpr::cpr)

2. Run `cmake --build build`
3. Error persists after building the includes folder in `/usr/include/`

![image](https://github.com/libcpr/cpr/assets/47896974/98238da1-18e4-4836-91d9-932f0cfa5a01)

Code:

include <cpr/cpr.h>

int main(int argc, char **argv) { cpr::Response r = cpr::Get(cpr::Url{"https://api.github.com/repos/whoshuu/cpr/contributors"}, cpr::Authentication{"user", "pass", cpr::AuthMode::BASIC}, cpr::Parameters{{"anon", "true"}, {"key", "value"}}); r.status_code; // 200 r.header["content-type"]; // application/json; charset=utf-8 r.text; // JSON text string return 0; }



### Possible Fix

_No response_

### Where did you get it from?

GitHub (branch e.g. master)

### Additional Context/Your Environment

![image](https://github.com/libcpr/cpr/assets/47896974/9d1b71e0-7730-4fe9-b427-daf49eefe9e9)