0

I am trying to use the cURL library(I am pretty new to libraries so I apologize for my ignorance). I use the command:

g++ -I"C:/Curl/include" distance.cpp -o run -L"C:\Program Files\Curl\lib" -lcurl

to compile my code.

I then try to run the .exe file called run. The execution fails and the error message says."The code execution cannot proceed because libcurl-x64.dll was not found." My initial thought was to change the name of the .dll file to match that of the error. The file that comes in the windows-64 bit version of curl is called libcurl.dll (my system claims that it is a ".A file"). I tried running the .exe file with the renamed "libcurl-x64.dll" file. A different error that says, that libcurl-x64.dll is either not designed to run on windows(which isn't the case because it is the Windows-64 bit version) or contains an error. Unless the source file from the cURL website is erroneous, I can't see how any files contain errors. I would think since curl is a popular library, its files are not meant to be renamed.

The funny thing is that I have 1) added libcurl.dll to my working directory and 2) added a system path called CURL_PATH to my environmental variables. I am not sure how the compiler cannot find this file.

I have followed this Trouble importing dll library into CodeBlocks Linker but my lib file does not have an additional folder inside of it.

There are a lot of variables that I have checked including the architecture of my chip.(I have The windows Surface 7 Snapdragon which uses ARM.) I initially tried the ARM64 version but received a "Files not recognized" error when compiling. I am now using the windows 64bit version of curl due to some other reading I have doing. Like stated before my code compiles to I think I resolved that issue. I also have a minimal reproducible example of my .cpp code and in case that helps.

Any help would be greatly appreciated. I imagine there is something else I have to do in order to link that file. I thought I was doing that when compiling but apparently not. I am using vscode. Please let me know if you have any questions. I appreciate your time!

My .cpp source code for reference:

#include <C:\Program Files\Curl\include\curl\curl.h> 
 
 int main() { 
    /*auto curl =*/ curl_easy_init(); 
    
    }
3
  • 1
    I believe you have installed Intel binaries for curl and not arm64 ones so there is nothing you can do with naming of the dlls or search path to fix that. You need to install compatible binaries for your architecture possibly compiling them yourself if they are not available. Commented Jan 8 at 17:10
  • 1
    @drescherjm note that x64 probably works just fine, but the exe and the dll need to be the same architecture (unless you're using arm64ec) Commented Jan 8 at 18:50
  • I believed that there was an incompatiblilty because of this part: "libcurl-x64.dll is either not designed to run on windows(which isn't the case because it is the Windows-64 bit version) or contains an error." Commented Jan 8 at 18:56

1 Answer 1

0

First, some recommendations regarding code & build. I's suggest to change your compiling command into

g++ -I"C:\Program Files\Curl\include" distance.cpp -o run -L"C:\Program Files\Curl\lib" -lcurl

Then, include libcurl header as follows in the source:

#include <curl.h>

That's how it should be done normally. I.e. normally your specify include path and include that way, compiler searches at include paths you've specified (-I option).

But these are only suggestions.

Second, make sure you are building using C++ compiler for ARM64 and installed ARM64 version of libcurl. I'd suggest using Visual Studio 2022 or install clangarm64 toolchain from MinGW. You likely have installed X64 version. Once that assured, all you need to do is to copy suitable libcurl DLL to your executable folder.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.