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

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

问题描述

我知道这是编程的问题,但我只是感到沮丧试图找出什么我做错了。

我使用Visual Studio 2010和这里遵循所有的步骤:<一href=\"http://curl.haxx.se/libcurl/c/visual_studio.pdf\">http://curl.haxx.se/libcurl/c/visual_studio.pdf

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

  1 GT; ------启动生成:项目:libcurl的,配置:调试的Win32 ------
1&GT; LibCurl.obj:错误LNK2019:​​在函数_main引用解析的外部符号__imp__curl_easy_cleanup
1&GT; LibCurl.obj:错误LNK2019:​​在函数_main引用解析的外部符号__imp__curl_easy_perform
1&GT; LibCurl.obj:错误LNK2019:​​解析外部符号__imp__curl_easy_setopt函数引用_main
1&GT; LibCurl.obj:错误LNK2019:​​解析外部符号__imp__curl_easy_init函数引用_main
1&GT; C:\\用户\\凯尔\\文档\\ Visual Studio 2010的\\ libcurl的\\ VisualStudio的\\ libcurl的\\调试\\ LibCurl.exe:致命错误LNK1120:4无法解析的外部
==========生成:0成功,1失败,0了最新,0已跳过==========

来源:

  // LibCurl.cpp:定义控制台应用程序的入口点。
//的#includestdafx.h中
#包括LT&;&stdio.h中GT;
#包括LT&;卷曲/ curl.h&GT;INT主要(无效)
{
  卷曲*卷曲;
  卷曲code资源;  卷曲= curl_easy_init();
  如果(卷曲){
    curl_easy_setopt(卷曲,CURLOPT_URL,http://google.com);
    RES = curl_easy_perform(卷曲);    / *总是清理* /
    curl_easy_cleanup(卷曲);
  }
  返回0;
}


解决方案

看起来像没有被成功链接库。确保库目录设置为包含完整路径的libcurl DLL。另外,还要确保该库实际上是添加到您的项目。

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

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:\Users\Kyle\Documents\Visual Studio 2010\libcurl\VisualStudio\LibCurl\Debug\LibCurl.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Source:

// 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;
}

解决方案

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天全站免登陆