2012-01-12 7 views
1

wxWidgetsプログラムのコンパイルに問題があります。私はそれをコンパイルしようとするとC++ 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 === 

は私が間違って何をしているのですか? int main()の代わりにOnInit()を使用する必要がありますか?たとえアプリケーションをコンソール以外のものにしたいのですが?

+0

どのようにあなたがこれをコンパイルしているの文書を参照するにもあるのでしょうか? – Arafangion

+0

'wxURL'が宣言されている名前空間とは何ですか? – Karlson

+0

あなたのwx設定が正しくないと思います。 wx/url.hはwxUSE_URLを定義する必要があります。そうでない場合、wxURLは宣言されません。 – LiMuBei

答えて

0

wxWidgetsのためのあなたのsetup.hファイルに見て、wxURLは、http://wiki.wxwidgets.org/Setup.H

を見てみましょう #defineセットアップファイル(setup.h)への詳細については
#define wxUSE_URL 1 

ようであることを確認してください

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