Fehler bei vector, string und sstream
-
HI Leute.
Habe ein komisches Problem, der Compiler will mein vector, string und meine sstreams nicht akzeptieren. Er sagt es ist kein Typ vorhanden obwohl ich alle nötigen Header eingebunden habe.
Hier die Header-Datei (der Vector steht ganz Unten):
#ifndef __PROPERTIES_h__ #define __PROPERTIES_h__ #ifdef __BORLANDC__ #pragma hdrstop #endif #ifndef WX_PRECOMP #include <wx/wx.h> #include <wx/frame.h> #else #include <wx/wxprec.h> #endif //Do not add custom headers between //Header Include Start and Header Include End. //wxDev-C++ designer will remove them. Add custom headers after the block. ////Header Include Start #include <wx/dirdlg.h> #include <wx/choice.h> #include <wx/textctrl.h> #include <wx/button.h> #include <wx/stattext.h> #include <wx/statbox.h> #include <wx/panel.h> ////Header Include End #include <vector> #include <string> #include <sstream> #include <windows.h> #include <Winreg.h> ////Dialog Style Start #undef Properties_STYLE #define Properties_STYLE wxCAPTION | wxSYSTEM_MENU | wxCLOSE_BOX ////Dialog Style End class Properties : public wxFrame { private: DECLARE_EVENT_TABLE(); public: Properties(wxWindow *parent, wxWindowID id = 1, const wxString &title = wxT("Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = Properties_STYLE); virtual ~Properties(); void butt_browse_dataClick(wxCommandEvent& event); void butt_browse_latexClick(wxCommandEvent& event); private: //Do not add custom control declarations between //GUI Control Declaration Start and GUI Control Declaration End. //wxDev-C++ will remove them. Add custom code after the block. ////GUI Control Declaration Start wxDirDialog *dir_path_to_data; wxDirDialog *dir_path_to_latex; wxButton *butt_browse_latex; wxButton *butt_browse_data; wxChoice *ch_com; wxTextCtrl *ed_path_to_latex; wxTextCtrl *ed_path_to_data; wxButton *butt_save_close; wxStaticText *WxStaticText3; wxStaticText *WxStaticText2; wxStaticText *WxStaticText1; wxStaticBox *box_properties; wxPanel *WxPanel1; ////GUI Control Declaration End private: //Note: if you receive any error with these enum IDs, then you need to //change your old form code that are based on the #define control IDs. //#defines may replace a numeric value for the enum names. //Try copy and pasting the below block in your old form header files. enum { ////GUI Enum Control ID Start ID_BUTT_BROWSE_LATEX = 1011, ID_BUTT_BROWSE_DATA = 1010, ID_CH_COM = 1009, ID_ED_PATH_TO_LATEX = 1008, ID_ED_PATH_TO_DATA = 1007, ID_BUTT_SAVE_CLOSE = 1006, ID_WXSTATICTEXT3 = 1004, ID_WXSTATICTEXT2 = 1003, ID_WXSTATICTEXT1 = 1002, ID_BOX_PROPERTIES = 1005, ID_WXPANEL1 = 1001, ////GUI Enum Control ID End ID_DUMMY_VALUE_ //don't remove this value unless you have other enum values }; private: void OnClose(wxCloseEvent& event); void CreateGUIControls(); // Meine Attribute private: vector<int> ports; }; #endif
Kann jemand bitte drüberschauen? vtl. übersehe ich etwas.
-
Jo, es muss std::vector heißen. Die komplette C++ Standardbibliothek befindet sich im Namensraum std. Durch ein Einfügen von using namespace std; kannst du das std:: dann auch weglassen. ABER: Mach das nie in Headern, da du sonst Namensraumkonflikte bekommen kannst!
Btw. Poste solche Probleme das nächste mal im C++ Subforum, da dies nicht direkt mit wxWidgets zusammenhängt, sondern ein C++ - only Thema ist. Danke
-
ja, diese Klassen gehören zum Namespace std.
Du musst also vor vector, string und sstream ein std:: setzen.
-
verdammt stimmt! Danke Leute. Ich sitze schon seit einer langen Zeit dran und bin nicht drauf gekommen.