简体   繁体   English

使用codelite c ++链接卷曲

[英]Link Curl using codelite c++

Edit: I used this guide, and it solved my issue!编辑:我使用了指南,它解决了我的问题! However, i get another error now: 32-make.exe[1]: *** [Debug/main.cpp.o] Error 1 mingw32-make.exe: *** [All] Error 2 API.mk:97: recipe for target 'Debug/main.cpp.o' failed ...但是,我现在遇到另一个错误: 32-make.exe[1]: *** [Debug/main.cpp.o] Error 1 mingw32-make.exe: *** [All] Error 2 API.mk:97: recipe for target 'Debug/main.cpp.o' failed ...

I have been trying for a couple of hours now, to link curl into my c++ project in CodeLite.我已经尝试了几个小时,将 curl 链接到我在 CodeLite 中的 C++ 项目。 Im a total noob, but i have tried a lot of things, but it does'nt seek to work.我是个菜鸟,但我尝试了很多东西,但它并没有寻求工作。 i have tried going to我试过去

project settings > linker > and changing the options to where my files are at. project settings > linker >并将选项更改为我的文件所在的位置。 So for example, in "Libraries search path" I wrote:例如,在"Libraries search path"我写道:

 C:\Users\Mio\Documents\curl-7.46.0-win64\lib\libcurl.lib;
 C:\Users\Mio\Documents\curl-7.46.0-win64\lib\libcurl.lib;
 C:\Users\Mio\Documents\curl-7.46.0-win64\lib\libcurl_a.lib;`

and in libraries I wrote在我写的libraries

 C:\Program Files (x86)\Dev-Cpp\MinGW64\lib\libcurl.a`

The error I am getting is:我得到的错误是:

 C:/Users/Mio/Documents/test27/API/main.cpp:4:23: fatal error: curl/curl.h: No such file or directory`

CodeLite's own tutorial is for an older version, and I don't quite get what I am supposed to do. CodeLite 自己的教程是针对旧版本的,我不太明白我应该做什么。 Please help!请帮忙!

First its important to understand which compiler you use.首先,了解您使用的编译器很重要。 By the look of it, it seems that you have downloaded the libcurl binaries for Visual Studio, but the error message you get from the compiler looks like a MinGW one...看起来,您似乎已经下载了 Visual Studio 的 libcurl 二进制文件,但是您从编译器收到的错误消息看起来像是 MinGW 的错误消息...

So the first step is to download proper package for MinGW所以第一步是为MinGW下载适当的包

Next, this error:接下来,这个错误:

C:/Users/Mio/Documents/test27/API/main.cpp:4:23: fatal error: curl/curl.h: No such file or directory C:/Users/Mio/Documents/test27/API/main.cpp:4:23: 致命错误: curl/curl.h: 没有那个文件或目录

Is a compiler error, not a linker.是编译器错误,而不是链接器。 This means gcc can not find the header file curl/curl.h .这意味着gcc找不到头文件curl/curl.h You should add the path to the include folder in CodeLite's project settings->Compiler->Include paths您应该在 CodeLite 的project settings->Compiler->Include paths添加include文件夹的project settings->Compiler->Include paths

After this, go to project settings->Linker->Library search paths and add the path to the lib directory (which contains the library file)之后,转到project settings->Linker->Library search paths并将project settings->Linker->Library search paths添加到lib目录(其中包含库文件)

Finally, add the library name in project settings->Linker->Libraries最后在project settings->Linker->Libraries添加库名

Attached are screenshots from a sample workspace that uses curl and MinGW (in this example, I used an environment variable to define the base folder of libcurl folder):附件是使用 curl 和 MinGW 的示例工作区的屏幕截图(在此示例中,我使用环境变量来定义 libcurl 文件夹的基本文件夹):

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

In my case previous answer helped me this far that I got all compiled and linked, but when starting application itself I got error: 0xc0000135.在我的情况下,以前的答案帮助我完成了所有编译和链接,但是在启动应用程序本身时出现错误:0xc0000135。 If you run your exe not from Codelite, but directly from Debug folder, it will tell you exactly which DLLs are missing.如果您不是从 Codelite 而是直接从 Debug 文件夹运行您的 exe,它会准确地告诉您缺少哪些 DLL。 In my case it was OpenSSL files, which I got after installing OpenSSL for Windows (x64 lite), then copied them to Debug folder, and now all works fine.就我而言,它是 OpenSSL 文件,这是我在为 Windows (x64 lite) 安装 OpenSSL 后得到的,然后将它们复制到 Debug 文件夹,现在一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM