eclipse C\Cpp中libcurl的链接器问题

eclipse C\Cpp中libcurl的链接器问题,c,eclipse,curl,libcurl,C,Eclipse,Curl,Libcurl,我试图在EclipseC\Cpp中使用libcurl,并将其交叉编译为大学项目的Raspberry Pi。我已经包含了头文件并在编译器中添加了-lcurl选项 #include <stdio.h> #include <unistd.h> //Used for UART #include <fcntl.h> //Used for UART #include <termios.h> //Used for

我试图在EclipseC\Cpp中使用libcurl,并将其交叉编译为大学项目的Raspberry Pi。我已经包含了头文件并在编译器中添加了-lcurl选项

#include <stdio.h>
#include <unistd.h>         //Used for UART
#include <fcntl.h>          //Used for UART
#include <termios.h>        //Used for UART
#include "anybus.h"
#include <string.h>
#include <time.h>
#include <wiringPi.h>
#include "curl.h"

int main()
{
CURL *curl;
CURLcode res;

struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "charsets: utf-8");

char* string = "{\"name\":\"JohnDoe\"}";
printf(string);


// In windows, this will init the winsock stuff
res = curl_global_init(CURL_GLOBAL_ALL);

// get a curl handle
curl = curl_easy_init();
if(curl) {
    //  First set the URL that is about to receive our POST. This URL can
    //  just as well be a https:// URL if that is what should receive the
    //  data.
    curl_easy_setopt(curl,CURLOPT_HTTPHEADER, headers );
    curl_easy_setopt(curl, CURLOPT_URL, "http://134.61.41.2:8080/Cascade/rest/maschinen");
    // Now specify the POST data
    curl_easy_setopt(curl, CURLOPT_POSTFIELDS, string);

    // Perform the request, res will get the return code
    res = curl_easy_perform(curl);

    // Check for errors
    if(res != CURLE_OK){
        printf("Curl Easy Perform failed\n");
    }
    // always cleanup
    curl_easy_cleanup(curl);
}
curl_global_cleanup();
}

有人知道发生了什么吗?

查看编译日志后,链接器似乎无法找到卷曲。。功能。因此,请在eclipse中的构建设置中进行验证

Building target: RaspAnybusDriver_2007.a
Invoking: Cygwin C++ Linker
arm-unknown-linux-gnueabi-g++ -L"c:\cygwin\opt\cross\x-tools\arm-unknown-linux-      gnueabi\arm-unknown-linux-gnueabi\sysroot\usr\lib" -L"C:\cygwin\raspberry\usr\lib" -L"C:\cygwin\lib\python2.7" -L"C:\cygwin\lib" -o "RaspAnybusDriver_2007.a"  ./anybus.o ./bytefloat.o ./main.o   -lrt -lcurl.dll -lwiringPi
./main.o: In function `main':
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:17: undefined reference to `curl_slist_append'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:18: undefined reference to `curl_slist_append'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:19: undefined reference to `curl_slist_append'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:26: undefined reference to `curl_global_init'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:29: undefined reference to `curl_easy_init'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:34: undefined reference to `curl_easy_setopt'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:35: undefined reference to `curl_easy_setopt'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:37: undefined reference to `curl_easy_setopt'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:40: undefined reference to `curl_easy_perform'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:47: undefined reference to `curl_easy_cleanup'
/cygdrive/c/Users/Bjorn/workspace/RaspAnybusDriver_2007/Debug/../main.c:49: undefined reference to `curl_global_cleanup'
collect2: ld returned 1 exit status
make: *** [RaspAnybusDriver_2007.a] Error 1