My C project cannot find curl for some reason, even though i do have curl.

已回答

In my project, i was using curl for something in the code and it keeps giving an error message that it cannot find curl, yet i do have curl, i've the files and everything it seems to all be there. I have tried everything from reinstalling, reloading cache, redownloading etc. etc. 

Anyone know what to do?

0

Hello!

  1. How did you install CURL on the machine?
  2. Please try to run CMake to configure the same project in the command line (outside CLion). Does it work?
1

Hello.

1. it is automatically installed on my device because it is a windows device, but i have tried to manually install it too, still does not work.

2. no, i will try and get back to you

0

it is automatically installed on my device because it is a windows device

Are you sure it comes with the curl library (libcurl)? I found curl.exe on my machine (in C:\Windows\System32), but I don't see libcurl.

The following worked on my side:

  1. Download curl from https://curl.se/windows/  and unpack it on the machine.
  2. Set the bundled MinGW toolchain as the default toolchain in CLion.
  3. Add the following lines to the CMakeLists.txt.

    set(CMAKE_PREFIX_PATH "<path to>\\curl-8.17.0_4-win64-mingw")
    find_package(CURL REQUIRED)
    target_link_libraries(<target name> CURL::libcurl)
  4. Do Tools | CMake | Reset Cache and Reload Project.
0

请先登录再写评论。