热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

即使有-lwininet链接标志,也没有定义。-C++wininetundefinedreferenceevenwith-lwininetlinkerflag

ImnewwithWinInetandhavefollowingsimpleC++code:我是WinInet的新手,有以下简单的c++代码:voidDoIt(std::s

I'm new with WinInet and have following simple C++ code:

我是WinInet的新手,有以下简单的c++代码:

void DoIt(std::string& host, std::string& username, std::string& password) {
    HINTERNET hInternet;
    HINTERNET hFtpSession;
    hInternet = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
    if (hInternet == NULL) {
        std::cout <<"Error: " <

But compiler's output is:

但是编译器的输出是:

Info: Configuration "Debug" uses tool-chain "MinGW GCC" that is unsupported on this system, attempting to build anyway.
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -std=c++11 -o main.o "..\\main.cpp" 
C:\Users\u007\AppData\Local\Temp\ccFEaWlK.o: In function `Z4DoItRSsS_S_':
C:\projects\ftp-test\Debug/../main.cpp:10: undefined reference to `_imp__InternetOpenA@20'
C:\projects\ftp-test\Debug/../main.cpp:14: undefined reference to `_imp__InternetConnectA@32'
C:\projects\ftp-test\Debug/../main.cpp:18: undefined reference to `_imp__FtpPutFileA@20'
collect2.exe: error: ld returned 1 exit status

(I link to wininet.lib library in Eclipse's linker) Adding <code>wininet.lib</code> in Eclipse

(我经由wininet链接。Eclipse的链接库中的lib库)

(I also tried to add -lwininet option to compiler but it does nothing)

(我还尝试向编译器添加-lwininet选项,但它什么也不做)

I use following software:

我使用以下软件:

  • OS: Windows 10 x64
  • 操作系统:Windows 10 x64
  • IDE: Eclipse Neon 3
  • Eclipse IDE:霓虹灯3
  • Compiler: MinGW (rubenvb-4.8-stdthread) 4.8.1 20130324 (prerelease)
  • 编译器:MinGW (rubenvb-4.8-stdthread) 4.8.1 20130324 (prerelease)

I saw following links: 1 2 3 but nothing there helps me.

我看到了以下链接:1 2 3,但没有任何帮助。

Thanks for any suggestion.

谢谢你的建议。

1 个解决方案

#1


0  

Based on the g++ compile line it's is missing the library to link to (wininet). You need in eclipse to add that library so your program link to it.

基于g++编译行,它缺少了链接到(wininet)的库。您需要在eclipse中添加该库,以便您的程序链接到它。


推荐阅读
author-avatar
已1注2销
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有