У меня есть проект wxWidgets в коде :: блоки с gcc, который уже работал нормально. Теперь я хотел добавить диалог, который открывается из меню, но теперь мой компилятор выдает ошибки относительно процесса CreateDialog
. Странно, у меня уже было два прекрасных рабочих диалоговые окна в моем проекте ...Ошибки после добавления wxDialog
Эти ошибки:
||=== Build: Debug in WindowsDgpsGUI (compiler: GNU GCC Compiler) ===|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h||In function 'HWND__* CreateDialog(HINSTANCE, LPCTSTR, HWND, DLGPROC)':|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h|38|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateDialogParamW(HINSTANCE, LPCWSTR, HWND, DLGPROC, LPARAM)'|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h||In function 'HFONT__* CreateFont(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCTSTR)':|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h|69|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '14' to 'HFONT__* CreateFontW(int, int, int, int, int, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPCWSTR)'|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h||In function 'HWND__* CreateWindow(LPCTSTR, LPCTSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)':|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h|94|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HWND__* CreateWindowExW(DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID)'|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h||In function 'HMENU__* LoadMenu(HINSTANCE, LPCTSTR)':|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h|111|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HMENU__* LoadMenuW(HINSTANCE, LPCWSTR)'|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h||In function 'HWND__* FindText(LPFINDREPLACE)':|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h|126|error: cannot convert 'LPFINDREPLACE {aka FINDREPLACEA*}' to 'LPFINDREPLACEW {aka FINDREPLACEW*}' for argument '1' to 'HWND__* FindTextW(LPFINDREPLACEW)'|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h||In function 'HICON__* LoadIcon(HINSTANCE, LPCTSTR)':|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h|311|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HICON__* LoadIconW(HINSTANCE, LPCWSTR)'|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h||In function 'HBITMAP__* LoadBitmap(HINSTANCE, LPCTSTR)':|
C:\wxWidgets-3.0.2\include\wx\msw\winundef.h|324|error: cannot convert 'LPCTSTR {aka const char*}' to 'LPCWSTR {aka const wchar_t*}' for argument '2' to 'HBITMAP__* LoadBitmapW(HINSTANCE, LPCWSTR)'|
D:\WindowsDgpsGui\RecordDialog.cpp||In member function 'void RecordDialog::OnButtonTrackNumberClick(wxCommandEvent&)':|
D:\WindowsDgpsGui\RecordDialog.cpp|142|warning: unused variable 'numberOfTracks' [-Wunused-variable]|
||=== Build failed: 7 error(s), 1 warning(s) (0 minute(s), 1 second(s)) ===|
Это, как я открыть диалог в main.cpp:
void WindowsDgpsGUIFrame::onRecordClick(wxCommandEvent& event)
{
RecordDialog* recordDialog = new RecordDialog(NULL);
recordDialog->SetGnssPort(m_usedVariables.gnssPort);
recordDialog->ShowModal();
recordDialog->Destroy();
}
RecordDialog.h
#ifndef RECORDDIALOG_H
#define RECORDDIALOG_H
#include "Serial.h"
#include <wx/string.h>
#include <wx/textfile.h>
//(*Headers(RecordDialog)
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/panel.h>
#include <wx/choice.h>
#include <wx/button.h>
#include <wx/dialog.h>
//*)
class RecordDialog: public wxDialog
{
public:
RecordDialog(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
virtual ~RecordDialog();
void SetGnssPort(wxString gnssPort);
//(*Declarations(RecordDialog)
wxButton* ButtonStartRecording;
wxTextCtrl* TextCtrlNumber;
wxStaticText* StaticTrackNumberText;
wxStaticText* StaticStatusText;
wxButton* ButtonFileName;
wxPanel* Panel1;
wxStaticText* StaticText1;
wxTextCtrl* TextCtrlFileName;
wxChoice* ChoiceTrack;
wxButton* ButtonTrackNumber;
wxStaticText* StaticTextFileName;
//*)
protected:
//(*Identifiers(RecordDialog)
static const long ID_STATICTEXT2;
static const long ID_TEXTCTRL1;
static const long ID_BUTTON2;
static const long ID_STATICTEXT3;
static const long ID_TEXTCTRL2;
static const long ID_BUTTON3;
static const long ID_STATICTEXT4;
static const long ID_CHOICE1;
static const long ID_STATICTEXT1;
static const long ID_BUTTON1;
static const long ID_PANEL1;
//*)
static const int STANDARD_BAUDRATE;
private:
//(*Handlers(RecordDialog)
void OnButtonStartRecordingClick(wxCommandEvent& event);
void OnTextCtrl1Text(wxCommandEvent& event);
void OnButtonFileNameClick(wxCommandEvent& event);
void OnButtonTrackNumberClick(wxCommandEvent& event);
//*)
DECLARE_EVENT_TABLE()
};
#endif
RecordDialog.cpp
#include "RecordDialog.h"
#include "Serial.h"
#include <wx/textfile.h>
#include <wx/valtext.h>
//(*InternalHeaders(RecordDialog)
#include <wx/intl.h>
#include <wx/string.h>
//*)
//(*IdInit(RecordDialog)
const long RecordDialog::ID_STATICTEXT2 = wxNewId();
const long RecordDialog::ID_TEXTCTRL1 = wxNewId();
const long RecordDialog::ID_BUTTON2 = wxNewId();
const long RecordDialog::ID_STATICTEXT3 = wxNewId();
const long RecordDialog::ID_TEXTCTRL2 = wxNewId();
const long RecordDialog::ID_BUTTON3 = wxNewId();
const long RecordDialog::ID_STATICTEXT4 = wxNewId();
const long RecordDialog::ID_CHOICE1 = wxNewId();
const long RecordDialog::ID_STATICTEXT1 = wxNewId();
const long RecordDialog::ID_BUTTON1 = wxNewId();
const long RecordDialog::ID_PANEL1 = wxNewId();
//*)
const int RecordDialog::STANDARD_BAUDRATE = 9600;
BEGIN_EVENT_TABLE(RecordDialog,wxDialog)
//(*EventTable(RecordDialog)
//*)
END_EVENT_TABLE()
RecordDialog::RecordDialog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
//(*Initialize(RecordDialog)
wxBoxSizer* BoxSizer4;
wxBoxSizer* BoxSizer6;
wxBoxSizer* BoxSizer5;
wxBoxSizer* BoxSizer2;
wxBoxSizer* BoxSizer1;
wxBoxSizer* BoxSizer3;
Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(208,288), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
BoxSizer1 = new wxBoxSizer(wxVERTICAL);
BoxSizer4 = new wxBoxSizer(wxVERTICAL);
StaticTextFileName = new wxStaticText(Panel1, ID_STATICTEXT2, _("Name the place file you want to create."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
BoxSizer4->Add(StaticTextFileName, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
TextCtrlFileName = new wxTextCtrl(Panel1, ID_TEXTCTRL1, _("File name"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
BoxSizer4->Add(TextCtrlFileName, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
ButtonFileName = new wxButton(Panel1, ID_BUTTON2, _("Set File Name"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON2"));
BoxSizer4->Add(ButtonFileName, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer1->Add(BoxSizer4, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer5 = new wxBoxSizer(wxVERTICAL);
StaticTrackNumberText = new wxStaticText(Panel1, ID_STATICTEXT3, _("How many tracks are there\?"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT3"));
BoxSizer5->Add(StaticTrackNumberText, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
TextCtrlNumber = new wxTextCtrl(Panel1, ID_TEXTCTRL2, _("Number of Tracks"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL2"));
BoxSizer5->Add(TextCtrlNumber, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
ButtonTrackNumber = new wxButton(Panel1, ID_BUTTON3, _("Set Number of Tracks"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON3"));
BoxSizer5->Add(ButtonTrackNumber, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer1->Add(BoxSizer5, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer6 = new wxBoxSizer(wxVERTICAL);
StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT4, _("Select which track you wnat to record."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT4"));
BoxSizer6->Add(StaticText1, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
ChoiceTrack = new wxChoice(Panel1, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1"));
ChoiceTrack->Disable();
BoxSizer6->Add(ChoiceTrack, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer1->Add(BoxSizer6, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer2 = new wxBoxSizer(wxVERTICAL);
StaticStatusText = new wxStaticText(Panel1, ID_STATICTEXT1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
BoxSizer2->Add(StaticStatusText, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer1->Add(BoxSizer2, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer3 = new wxBoxSizer(wxHORIZONTAL);
ButtonStartRecording = new wxButton(Panel1, ID_BUTTON1, _("Start Recording"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
ButtonStartRecording->Disable();
BoxSizer3->Add(ButtonStartRecording, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
BoxSizer1->Add(BoxSizer3, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
Panel1->SetSizer(BoxSizer1);
BoxSizer1->Fit(Panel1);
BoxSizer1->SetSizeHints(Panel1);
Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&RecordDialog::OnTextCtrl1Text);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&RecordDialog::OnButtonFileNameClick);
Connect(ID_BUTTON3,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&RecordDialog::OnButtonTrackNumberClick);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&RecordDialog::OnButtonStartRecordingClick);
//*)
TextCtrlNumber->SetValidator(wxTextValidator(wxFILTER_DIGITS));
}
RecordDialog::~RecordDialog()
{
//(*Destroy(RecordDialog)
//*)
}
void RecordDialog::OnButtonStartRecordingClick(wxCommandEvent& event)
{
;
}
void RecordDialog::SetGnssPort(wxString gnssPort)
{
;
}
void RecordDialog::OnTextCtrl1Text(wxCommandEvent& event)
{
}
void RecordDialog::OnButtonFileNameClick(wxCommandEvent& event)
{
;
}
void RecordDialog::OnButtonTrackNumberClick(wxCommandEvent& event)
{
;
}
Кто-нибудь знает, что не так?
@ AHue, вы построили библиотеку с помощью --enable-unicode? – Igor
@Igor Да, я сделал. Но проект тоже ... – Lehue