【发布时间】:2016-04-20 01:09:18
【问题描述】:
我在我的 cpp 应用程序中使用 libcurl 7.19 版。我正在尝试使用kukuruku.co 给出的示例。当我尝试构建应用程序时,出现以下错误,
lib/libcurl.a(libcurl_la-http_negotiate.o): In function `cleanup':
http_negotiate.c:(.text+0x1b): undefined reference to `gss_delete_sec_context'
http_negotiate.c:(.text+0x30): undefined reference to `gss_release_buffer'
http_negotiate.c:(.text+0x45): undefined reference to `gss_release_name'
lib/libcurl.a(libcurl_la-http_negotiate.o): In function `Curl_output_negotiate':
http_negotiate.c:(.text+0x123): undefined reference to `gss_release_buffer'
http_negotiate.c:(.text+0x1c0): undefined reference to `gss_release_buffer'
lib/libcurl.a(libcurl_la-http_negotiate.o): In function `Curl_input_negotiate':
http_negotiate.c:(.text+0x324): undefined reference to `GSS_C_NT_HOSTBASED_SERVICE'
http_negotiate.c:(.text+0x33a): undefined reference to `gss_import_name'
http_negotiate.c:(.text+0x48e): undefined reference to `gss_release_buffer'
http_negotiate.c:(.text+0x4cc): undefined reference to `gss_release_buffer'
这是我正在使用的代码 sn-p,
#include <stdio.h>
#include <curl/curl.h>
int main(void)
{
CURL *curl;
CURLcode res;
curl = curl_easy_init();
if(curl) {
curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
/* example.com is redirected, so we tell libcurl to follow redirection */
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
/* Perform the request, res will get the return code */
res = curl_easy_perform(curl);
/* Check for errors */
if(res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(res));
/* always cleanup */
curl_easy_cleanup(curl);
}
return 0;
}
我的 Makefile 看起来像这样,
CCFLAGS = -g -Wall -pthread -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DUSE_APACHE2 -fno-strict-aliasing -fmessage-length=0 -fPIC - O0 -ftemplate-depth-32 -fno-operator-names -D_GNU_SOURCE -D_GSS_C_NT_HOSTBASED_SERVICE
CFLAGS += `pkg-config --cflags libcurl`
LDFLAGS += `pkg-config --libs libcurl`
#DCMAKE_BUILD_TYPE=Release
#LIBS += -libcurl
我使用 module.mk 文件作为目标,
APP_OBJECTS = \
app-client/app-client-cmd.o \
$(NULL)
有人可以帮我解决这个问题吗?
【问题讨论】: