[Dev C ++]用curl库编译程序的问题

时间:2013-02-01 13:16:26

标签: c++ curl libcurl

您好我想使用DevCpp和MinGW64编译器编译Windows .EXE应用程序。我想编译的应用程序非常简单,需要CURL库。我使用的是Windows 8 64bit,Orwell Dev-C ++ V 5.3.0.4。我从官方网站下载了CURL库(Win64 - MinGW64 devel v.28.1)。我已将所有include,bin和lib文件复制到MinGW64文件夹,但程序无法编译,因为它收到以下链接器错误:

            [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x37): undefined reference to `__imp_curl_global_init'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x74): undefined reference to `__imp_curl_formadd'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0xb1): undefined reference to `__imp_curl_formadd'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0xba): undefined reference to `__imp_curl_easy_init'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0xd5): undefined reference to `__imp_curl_slist_append'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x100): undefined reference to `__imp_curl_easy_setopt'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x157): undefined reference to `__imp_curl_easy_setopt'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x173): undefined reference to `__imp_curl_easy_setopt'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x183): undefined reference to `__imp_curl_easy_perform'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x19a): undefined reference to `__imp_curl_easy_strerror'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x1cc): undefined reference to `__imp_curl_easy_cleanup'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x1dc): undefined reference to `__imp_curl_formfree'
        [Linker error] C:\Users\Panos\AppData\Local\Temp\ccSFo7Pn.o:upload.cpp:(.text+0x1ec): undefined reference to `__imp_curl_slist_free_all'
        collect2: ld returned 1 exit status

我唯一能够编译程序的是编译器的-DCURL_STATICLIB -c -h -Icurl \ include选项,但我得到的是一个无法在我的操作系统中运行的16位应用程序!

我试图编译的代码就是这个CURL示例: http://curl.haxx.se/libcurl/c/postit2.html

我花了很多时间在网上搜索并阅读指南,让我的程序编译但没有任何运气。请帮帮我,告诉我我做错了什么!

谢谢!

1 个答案:

答案 0 :(得分:0)

如果在尝试运行已编译的二进制文件时要求libcurl.dll,则在运行时需要libcurl.dll。尝试将libcurl.dll放在二进制文件的工作目录中。