- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
在编译我的 wxWidget HelloWorld 应用程序时,出现以下错误:
Warning 1 warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library wxWidget__HelloWorld wxWidget__HelloWorld
Error 2 error LNK2001: unresolved external symbol "public: virtual bool __thiscall wxApp::Initialize(int &,wchar_t * *)" (?Initialize@wxApp@@UAE_NAAHPAPA_W@Z) minimal.obj wxWidget__HelloWorld
Error 3 error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssertFailure(wchar_t const *,int,wchar_t const *,wchar_t const *,wchar_t const *)" (?OnAssertFailure@wxAppConsole@@UAEXPB_WH000@Z) minimal.obj wxWidget__HelloWorld
Error 4 error LNK2001: unresolved external symbol "public: virtual void __thiscall wxAppConsole::OnAssert(wchar_t const *,int,wchar_t const *,wchar_t const *)" (?OnAssert@wxAppConsole@@UAEXPB_WH00@Z) minimal.obj wxWidget__HelloWorld
Error 5 error LNK2019: unresolved external symbol "protected: void __thiscall wxStringBase::InitWith(wchar_t const *,unsigned int,unsigned int)" (?InitWith@wxStringBase@@IAEXPB_WII@Z) referenced in function "public: __thiscall wxStringBase::wxStringBase(wchar_t const *)" (??0wxStringBase@@QAE@PB_W@Z) minimal.obj wxWidget__HelloWorld
Error 6 error LNK2019: unresolved external symbol "public: int __cdecl wxString::Printf(wchar_t const *,...)" (?Printf@wxString@@QAAHPB_WZZ) referenced in function "public: void __thiscall MyFrame::OnAbout(class wxCommandEvent &)" (?OnAbout@MyFrame@@QAEXAAVwxCommandEvent@@@Z) minimal.obj wxWidget__HelloWorld
Error 7 error LNK2001: unresolved external symbol "wchar_t const * const wxEmptyString" (?wxEmptyString@@3PB_WB) minimal.obj wxWidget__HelloWorld
Error 8 error LNK2001: unresolved external symbol "wchar_t const * const wxStatusLineNameStr" (?wxStatusLineNameStr@@3QB_WB) minimal.obj wxWidget__HelloWorld
Error 9 error LNK2001: unresolved external symbol "wchar_t const * const wxFrameNameStr" (?wxFrameNameStr@@3QB_WB) minimal.obj wxWidget__HelloWorld
Error 10 error LNK2019: unresolved external symbol "void __cdecl wxOnAssert(wchar_t const *,int,char const *,wchar_t const *,wchar_t const *)" (?wxOnAssert@@YAXPB_WHPBD00@Z) referenced in function "public: __thiscall wxStringBase::wxStringBase(class wxStringBase const &)" (??0wxStringBase@@QAE@ABV0@@Z) minimal.obj wxWidget__HelloWorld
Error 11 fatal error LNK1120: 9 unresolved externals F:\C++\_2008_\wxWidget__HelloWorld\Debug\wxWidget__HelloWorld.exe wxWidget__HelloWorld
我的源码如下:
//
Name: minimal.cpp
// Purpose: Minimal wxWidgets sample
// Author: Julian Smart
#include "wx/wx.h"
// Declare the application class
class MyApp : public wxApp
{
public:
// Called on application startup
virtual bool OnInit();
};
// Declare our main frame class
class MyFrame : public wxFrame
{
public:
// Constructor
MyFrame(const wxString& title);
// Event handlers
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
private:
// This class handles events
DECLARE_EVENT_TABLE()
};
// Implements MyApp& GetApp()
DECLARE_APP(MyApp)
// Give wxWidgets the means to create a MyApp object
IMPLEMENT_APP(MyApp)
// Initialize the application
bool MyApp::OnInit()
{
// Create the main application window
MyFrame *frame = new MyFrame(wxT("Minimal wxWidgets App"));
// Show it
frame->Show(true);
// Start the event loop
return true;
}
// Event table for MyFrame
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)
EVT_MENU(wxID_EXIT, MyFrame::OnQuit)
END_EVENT_TABLE()
void MyFrame::OnAbout(wxCommandEvent& event)
{
wxString msg;
msg.Printf(wxT("Hello and welcome to %s"),
wxVERSION_STRING);
wxMessageBox(msg, wxT("About Minimal"),
wxOK | wxICON_INFORMATION, this);
}
void MyFrame::OnQuit(wxCommandEvent& event)
{
// Destroy the frame
Close();
}
#include "mondrian.xpm"
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
// Set the frame icon
SetIcon(wxIcon(mondrian_xpm));
// Create a menu bar
wxMenu *fileMenu = new wxMenu;
// The "About" item should be in the help menu
wxMenu *helpMenu = new wxMenu;
helpMenu->Append(wxID_ABOUT, wxT("&About...\tF1"),
wxT("Show about dialog"));
fileMenu->Append(wxID_EXIT, wxT("E&xit\tAlt-X"),
wxT("Quit this program"));
// Now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar();
menuBar->Append(fileMenu, wxT("&File"));
menuBar->Append(helpMenu, wxT("&Help"));
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
// Create a status bar just for fun
CreateStatusBar(2);
SetStatusText(wxT("Welcome to wxWidgets!"));
}
缺少什么?
最佳答案
确保您的项目设置与所有依赖项正在使用的设置相匹配(实际上您应该匹配依赖项:))。
可能导致 MS 工具链链接问题的设置(除了明显的根本不链接库之外):
当您知道那个该死的 unresolved-wchar_t*-containing-symbol 在您刚刚链接到的该死的库中时,这可能是这两个中的一个。
这就是您的 LIBCMTD 警告的原因。以及缺少/冲突的符号,如 __free 或 malloc 或其他标准外观的东西。奇怪的是,当你跨越 dll 边界时,甚至在空地方,如果你设法将 2 个不同的运行时链接到一个二进制文件中,甚至在空的地方都没有崩溃(我已经看到了!)。
一些库使用它们来决定代码是静态链接还是动态链接。它们通常会影响 lib 或 dll 附带的 header 。你必须知道你是否需要它们。 RTFM 或查看这些工作示例项目的配置。
所以对于你的问题,首先确保你添加了你必须的任何 wxWidget 库(以及它们需要的任何依赖项)。搜索任何缺失的符号,让谷歌指导你。有人会遇到同样的问题,并且会在自己弄清楚之前将其张贴在某个地方。
一个好的搜索词是
virtual bool __thiscall wxApp::Initialize
运行时需要特别小心。当您获得所需的所有库,但收到 libcmt* 或 msvc* 警告或冲突时,请检查所有项目设置并检查我列出的 4 个项目是否正确且一致。如果您没有自己构建它们,那么您也必须了解它们的依赖关系。使用链接器详细信息标志也可以准确查看谁带来了不需要的运行时。
其他编译器和链接器设置也可能会影响事情,因此请仔细梳理它们。
其中大部分更改都需要干净地重新编译。
这就是构建 C++ 代码的乐趣。
关于C++ : wxWidget HelloWorld,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1409031/
这个问题已经有答案了: What does "Could not find or load main class" mean? (63 个回答) 已关闭 7 年前。 我用java语言编写了一个简单的程
在使用 Expo 的 React Native 项目中,我尝试使用 export 部署以下云函数: 注意:我在 index.js 中使用 Javascript。 export const helloW
解决了“无法找到或加载主类Hello”错误的问题后...运行程序后我再次遇到这个问题(我使用文本板)代码是: class HelloWorld { public static void m
我最初尝试像这样推送我的(有史以来第一次!)git repo: $ git push helloworld 但我得到了这个: To git-smichaels@free5.projectlocker.
全新安装,通过 vue cli 安装 Vue。运行 vue create app并使用基本配置进行设置。 从 Home.vue 中删除 HelloWorld.vue 组件和附带的导入代码。 运行 np
我第一次编程有点问题。我收到消息 可以获取“c:\users\amittler\source\repos\HelloWorld...”吗? 谢谢你的帮助 最佳答案 是的,得到这个就可以了。 您的 ID
好的,我只是无法让 java 运行我的 .class 文件:我按照 Oracle tutorial 中的步骤操作并尝试运行这个程序: class HelloWorldApp { public
我是 Scala 和 SBT 的新手,所以我可能会遗漏一些明显的东西。 我试图在 http://www.scalafx.org/docs/quickstart/ 上编译 HelloWorld 示例 我
这是我的设置: docker pull riot/riotbuild wget https://github.com/RIOT-OS/RIOT/archive/2019.04.zip unzip 20
我一直在尝试创建我的第一个 Jenkins 插件。一切都很好,只是全局配置在 jenkins 服务重新启动后不会保留。 只要服务不重新启动,配置就可以很好地保存。 全局配置果冻文件... Jenki
我尝试从终端运行基本的 HelloWorld.class 文件。 我使用以下输入: Java HelloWorld.class 但它说: Error: Could not find or load "
以下代码取自 http://doc.akka.io/docs/akka/2.2.3/AkkaScala.pdf import akka.actor.Actor object Greeter { c
我带着这样一个微不足道的问题来到 Stack Exchange 感到内疚,但我整个上午都在为它苦苦思索,似乎无处可去。我正在尝试运行 Grails 教程中的简单 HelloWorld 应用程序:htt
好吧,这真的让我很生气。我在我的模拟器和安卓设备上都运行了它。该代码不显示“Helloworld, Android -mykong.com”。我启动应用程序,在模拟器上找到它,单击它,它会转到应用程序
我回到了 c++(我已经好几年没用过它了)来学习 box2d API。 我确切地说我在 Linux 系统 (Ubuntu) 上并且我已经从 this guide 之后的源代码安装了 box2d(2.3
社区成员推荐我分析以下内容,以了解 ARM 架构中发出的系统调用。我怀疑如何在这种结构中获取程序。我已经尝试过 gdb disas 命令,但部分不可见。请帮助。 .data HelloWorldStr
在编译我的 wxWidget HelloWorld 应用程序时,出现以下错误: Warning 1 warning LNK4098: defaultlib 'LIBCMTD' conflicts
我刚刚为我的 eclipse 安装了 c/c++ 开发工具,一切正常,除了当我运行 hello world 程序时控制台中没有打印任何文本,但我没有收到任何错误。我真的很困惑,有人知道这是为什么吗?
我在以下文件夹 C:\Program Files\Java 中安装了 Java 1.7.0。我的操作系统是带有 Service Pack 3 的 Windows XP(2002 版)。 我设置的环境变
前言 讲解Spring之前,我们首先梳理下Spring有哪些知识点可以进行入手源码分析,比如: Spring IOC依赖注入 Spring AOP切面编程 Spri
我是一名优秀的程序员,十分优秀!