使用 libcurl 链接程序时未解析的符号 [英] Unresolved symbols when linking a program using libcurl

查看:27
本文介绍了使用 libcurl 链接程序时未解析的符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这是编程问题,但我只是很沮丧试图找出我做错了什么..

I know this is programming questions but I'm just frustrated trying to figure out what I'm doing wrong..

我正在使用 Visual Studio 2010 并按照此处的所有步骤操作:http://curl.haxx.se/libcurl/c/visual_studio.pdf

I'm using visual studio 2010 and followed all the steps here: http://curl.haxx.se/libcurl/c/visual_studio.pdf

当我尝试编译我的解决方案时,我不断收到此错误:

When I try to compile my solution I keep getting this error:

1>------ Build started: Project: LibCurl, Configuration: Debug Win32 ------
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_cleanup referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_perform referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_setopt referenced in function _main
1>LibCurl.obj : error LNK2019: unresolved external symbol __imp__curl_easy_init referenced in function _main
1>C:UsersKyleDocumentsVisual Studio 2010libcurlVisualStudioLibCurlDebugLibCurl.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

来源:

// LibCurl.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#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://google.com");
    res = curl_easy_perform(curl);

    /* always cleanup */ 
    curl_easy_cleanup(curl);
  }
  return 0;
}

推荐答案

看起来库没有成功链接.确保库目录设置为包含 libcurl dll 的完整路径.还要确保此库确实已添加到您的项目中.

Looks like the libraries are not being successfully linked. Ensure the library directory is set to include the full path to the libcurl dll. Also make sure this library is actually added to your project.

这篇关于使用 libcurl 链接程序时未解析的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆