【发布时间】:2019-10-18 14:19:47
【问题描述】:
我将 wxwidgets 安装到 Visual Studio 2019 首先我为 Visual Studio 安装 wxwidgets 然后我打开“sln 15”然后我在调试、调试 dll、relese dll 和 relese 中构建它然后我打开项目属性并更改一些属性以包括包括文件夹和库 然后我在小部件网站上复制了“hello world”示例,但是当我按下调试按钮运行代码时,出现了两条错误消息,第一条是无法执行,因为找不到“wxmsw312u_core_vc_custom.dll” 第二个找不到“wxbase312u_vc_custom.dll” 代码是: `
// wxWidgets "Hello World" Program
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
class MyApp : public wxApp
{
public:
virtual bool OnInit();
};
class MyFrame : public wxFrame
{
public:
MyFrame();
private:
void OnHello(wxCommandEvent& event);
void OnExit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
};
enum
{
ID_Hello = 1
};
wxIMPLEMENT_APP(MyApp);
bool MyApp::OnInit()
{
MyFrame *frame = new MyFrame();
frame->Show(true);
return true;
}
MyFrame::MyFrame()
: wxFrame(NULL, wxID_ANY, "Hello World")
{
wxMenu *menuFile = new wxMenu;
menuFile->Append(ID_Hello, "&Hello...\tCtrl-H",
"Help string shown in status bar for this menu item");
menuFile->AppendSeparator();
menuFile->Append(wxID_EXIT);
wxMenu *menuHelp = new wxMenu;
menuHelp->Append(wxID_ABOUT);
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&File");
menuBar->Append(menuHelp, "&Help");
SetMenuBar( menuBar );
CreateStatusBar();
SetStatusText("Welcome to wxWidgets!");
Bind(wxEVT_MENU, &MyFrame::OnHello, this, ID_Hello);
Bind(wxEVT_MENU, &MyFrame::OnAbout, this, wxID_ABOUT);
Bind(wxEVT_MENU, &MyFrame::OnExit, this, wxID_EXIT);
}
void MyFrame::OnExit(wxCommandEvent& event)
{
Close(true);
}
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxMessageBox("This is a wxWidgets Hello World example",
"About Hello World", wxOK | wxICON_INFORMATION);
}
void MyFrame::OnHello(wxCommandEvent& event)
{
wxLogMessage("Hello world from wxWidgets!");
}`
【问题讨论】:
-
请提供edit您的问题以在问题本身中包含minimal reproducible example,而不是隐藏在外部链接后面。
-
@mohammadabdelhady,我想你自己建立了这个库。在这种情况下,您应该在 lib\vc_dll 目录中拥有文件
wxmsw312u_core_vc_custom.dll。将该文件复制到hello_world.exe所在的文件夹,然后重试。但最好打开 wxWidgets\samples\minimal\minimal_vc15.sln 并构建/运行它。 -
我将这些文件复制到项目文件中,它工作了
-
每次我想用 wxwidgets 创建一个项目时,我是否必须自己构建库,或者我可以复制这个项目并重写代码
标签: c++ visual-studio wxwidgets