【问题标题】:two error messeges saying cant excute becuse missing files (wxmsw312u_core_vc_custom.dll,wxbase312u_vc_custom.dll) how to solve it两个错误消息说无法执行因为缺少文件(wxmsw312u_core_vc_custom.dll,wxbase312u_vc_custom.dll)如何解决
【发布时间】: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


【解决方案1】:

当您将 wxWidgets 库构建为 DLL 时,您需要这些 DLL 来运行使用它们的应用程序,就像使用任何其他 DLL 一样。 DLL 不需要与应用程序位于同一目录中(尽管这样做确实有效),您也可以将包含它们的目录添加到您的 PATH 环境变量中。

或者,将 wxWidgets 构建为静态库 -- 这样您就不会对它们有任何运行时依赖项。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-04
    • 1970-01-01
    • 1970-01-01
    • 2012-01-10
    • 1970-01-01
    • 2016-12-16
    • 2021-04-03
    相关资源
    最近更新 更多