1

您好,我想使用 DevCpp 和 MinGW64 编译器编译一个 windows .EXE 应用程序。我要编译的应用程序非常简单,需要 CURL 库。我正在使用 Windows 8 64 位,Orwell Dev-C++ V 5.3.0.4。我已经从官方网站(Win64 - MinGW64 devel v.28.1)下载了 CURL 库。我已将所有包含、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

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

谢谢!

4

1 回答 1

0

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

于 2013-05-27T05:46:07.030 回答