wininet.h不使用带有代码块的GNU GCC编译器编译
wininet.h not compiling using GNU GCC compiler with code blocks
我在编译程序时遇到了一个特殊的问题。我在c++方面没有丰富的经验。我试图简单地创建一个功能,可以FTP把文件到我的普通FTP服务器。我正在使用代码块IDE和GNU GCC编译器,最后,我想尝试一个我在网上找到的完整的例子来测试是不是我写了一些愚蠢的代码。我已经安装了windows SDK与所有库,所以我可以确认文件存在,如果我构建没有任何代码,没有链接器错误。
我复制了OP的代码,因为它看起来很好,他抱怨没有这样的问题。http://social.msdn.microsoft.com/Forums/en-US/76eb8b89-4b96-41ba-b869-e30711f29256/ftpputfile?forum=vcgeneral
然而,当我试图构建我的项目,我得到一个过多的错误:
||=== Build: Debug in uploader (compiler: GNU GCC Compiler) ===|
C:C++uploadermain.cpp||In function 'void FileSubmit()':|
C:C++uploadermain.cpp|10|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:C++uploadermain.cpp|11|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
C:C++uploadermain.cpp|12|warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]|
objDebugmain.o:main.cpp|| undefined reference to `InternetOpenA@20'|
objDebugmain.o:main.cpp|| undefined reference to `InternetConnectA@32'|
objDebugmain.o:main.cpp|| undefined reference to `FtpPutFileA@20'|
objDebugmain.o:main.cpp|| undefined reference to `InternetCloseHandle@4'|
objDebugmain.o:main.cpp|| undefined reference to `InternetCloseHandle@4'|
||=== Build failed: 5 error(s), 3 warning(s) (0 minute(s), 1 second(s)) ===|
你知道我哪里做错了吗?我需要使用某些编译器设置吗?
对于遇到此问题的其他人。正如Igor在op的注释中所暗示的那样,解决这个问题的方法是手动添加到库的链接。在代码块中,这是通过进入project -> Build Options,单击链接器选项卡,然后手动浏览到文件并包含它来完成的。这现在已经使我的项目编译。为什么代码块需要这样,我不知道。但确实如此,所以谢谢你,伊戈尔。
相关文章:
- 如何使用 gnu gcc 标志 -mpc32、-mpc64 和 -mpc80?
- template-id 与任何模板声明 GNU gcc 编译器都不匹配
- 为什么在 Gnu gcc/g++ 中解析三元组序列的字符串文字?
- 安装GCC:致命错误:GNU/Stubs-32.h:没有这样的文件或目录
- GNU GCC会跟踪以前使用箭头操作员对的对象
- ./lib/gcc/x86_64-linux-gnu/4.6/libstdc++.a 的用法是什么
- Solaris 上的 GNU gcc/g++ 编译器版本,支持 C++11/14
- flens lapack:需要GNU GCC 4.7版或更高版本!我的mac有
- GNU GCC:尝试编译发行版时对"WinMain@16"的未定义引用(代码::Blocks)
- C++找不到 python 库.代码阻止GNU GCC
- 如何使GNU GCC类似地优化OpenMP线程
- GNU gcc mysys make command no rule to make target libpng
- 如何修复错误:命令'x86_64-linux-gnu-gcc'失败,退出状态为 1
- GNU GCC 编译器错误"multiple definition of main"
- 如何阻止GNU GCC破坏dll导入函数名
- wininet.h不使用带有代码块的GNU GCC编译器编译
- C++ GNU GCC 与 #define out 和 colleding
- Mac OS X Lion上的GNU GCC 4.6(0.1)编译器
- GNU GCC (g++):为什么它生成多个博士
- 为什么gnu gcc和cygwin gcc编译的文件大小不同?