C++wxWidgets应用程序未编译
C++ wxWidgets application not compiling
我在编译wxWidgets程序时遇到问题。
#include <wx/wx.h>
#include <wx/url.h>
#include <wx/stream.h>
#include <wx/sstream.h>
int main(int argc, char* argv[])
{
wxURL url(wxT("http://google.com"));
if (url.GetError()==wxURL_NOERR)
{
wxString htmldata;
wxInputStream *in = url.GetInputStream();
if (in && in->IsOk())
{
wxStringOutputStream html_stream(&htmldata);
in->Read(html_stream);
}
wxPuts(html_stream.GetString();
}
}
当我试图编译它时,我会得到以下错误:
main.cpp In function 'int main(int, char**)':
main.cpp 8 error: 'wxURL' was not declared in this scope
main.cpp 8 error: expected ';' before 'url'
main.cpp 9 error: 'url' was not declared in this scope
main.cpp 9 error: 'wxURL_NOERR' was not declared in this scope
main.cpp 12 error: 'wxInputStream' was not declared in this scope
main.cpp 12 error: 'in' was not declared in this scope
main.cpp 15 error: 'wxStringOutputStream' was not declared in this scope
main.cpp 15 error: expected ';' before 'html_stream'
main.cpp 16 error: 'html_stream' was not declared in this scope
main.cpp 18 error: 'html_stream' was not declared in this scope
=== Build finished: 10 errors, 0 warnings ===
我做错了什么?我应该使用OnInit()而不是int main()吗?即使我希望应用程序是控制台,而不是gui?
查看wxWidgets的setup.h文件,并确保wxURL是#define
作为
#define wxUSE_URL 1
有关设置文件(setup.h)的更多信息,请查看http://wiki.wxwidgets.org/Setup.H
要查看wxURL的示例,请查看wxWidgets文件夹,转到"samples"并查看"sockets_client"。
也有参考文件
http://docs.wxwidgets.org/2.9.3/classwx_u_r_i.html
http://wiki.wxwidgets.org/WxURL
http://wiki.wxwidgets.org/Download_a_file_from_internet
相关文章:
- 如何在 docker 中使用静态 opencv 库编译 c++ 应用程序
- MSVC 2010 编译应用程序和 MSVC 2019 编译应用程序之间的行为差异
- GCC编译器,为较低版本的GCC编译应用程序
- 通过编译应用程序创建Windows服务
- 如何在RPi3上的交叉编译应用程序的主窗口上显示边框和标题栏
- 如何使用模块在C中编译应用程序
- 如何在Windows中为Unix/Linux编译C++应用程序
- 编译应用程序时出现 C++ 错误
- 用GCC编译FreeRTOS,用G++编译应用程序代码
- 编译C 应用程序(Apache Thrift)时出错
- 尝试使用 boost::interprocess::managed_shared_memory::构造<T>编译应用程序时出错
- Windows 7和c++:用于Raspberry Pi的交叉编译应用程序
- 编译C++应用程序提供随机浮点值
- 是否可以更改已编译应用程序中的字节数组(4)
- VC++库在编译应用程序时错过?解压缩.obj :错误LNK2019
- 编译c++应用程序时出现未定义的引用错误
- 编译应用程序时出现奇怪错误
- 确定是否使用_DEBUG宏编译应用程序
- 为什么我的AMD CPU在编译应用程序时出现问题?
- 使用QT和OpenGL编译c++应用程序的问题