- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到一些奇怪的错误,如 Assert Failed
f:\dd\...\include\afxwin1.inl
。我在 Google 中搜索了一些解决方案,一些解决方案用于在 Release模式下注释此行 (m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
) 以使其工作。但是在评论该行之后,我遇到了更多错误。
我采用了基于对话框的 MFC 应用程序。当它是 application.exe
时,它工作得非常好。我的要求是让它成为 static library
我将有另一个 console application
它将成为主要的 application.exe
,我正在调用 来自
。一旦它捕获了这条线,.exe
的 InitInstance
CDialogDlg::CDialogDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CDialogDlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
它抛出上述错误。
在我的application.cpp
#include "stdafx.h"
#include "DialogDlg.h"
#include "Dialog.h"
#include "afxwin.h"
#include "Resource.h"
#include <afxinet.h>
CDialogApp theApp;
int _tmain(int argc, _TCHAR* argv[])
{
//CInitApp cpp;
theApp.InitInstance();
return 0;
}
Dialog.cpp
#include "stdafx.h"
#include "Dialog.h"
#include "DialogDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CDialogApp
BEGIN_MESSAGE_MAP(CDialogApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CDialogApp construction
CDialogApp::CDialogApp()
{
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
}
//CDialogApp theApp;// I have commented this code as I am declaring it in mainapplication
BOOL CDialogApp::InitInstance()
{
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
AfxEnableControlContainer();
CShellManager *pShellManager = new CShellManager;
//SetRegistryKey(_T("Local AppWizard-Generated Applications"));
CDialogDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
if (pShellManager != NULL)
{
delete pShellManager;
}
return FALSE;
}
我在 Dialog.cpp
中评论了 CDialogApp theApp;
行,因为我在 mainapplication .exe
中调用它 问题发生在它到达CDialogDlg dlg;
。请帮我解决这个错误。
以其他方式可以将基于对话框的应用程序设置为静态库。如果是,那为什么我会收到此错误。我也尝试过在 Windows 和控制台中制作主要应用程序。请找到屏幕截图以便更好地理解我要做什么。
最佳答案
静态库不包含任何资源,但您的对话框代码会尝试加载图标和对话框模板资源。您是否将资源移至控制台应用程序? (我不知道这是否行得通,但如果你不这样做肯定行不通。)
常规且受支持的解决方案是将对话框代码放入 DLL 而不是静态库。 DLL 可以包含资源。
关于c++ - m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);断言失败 : at afxwin1. inl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19367464/
我为发布这个问题道歉,编译时出现错误 fatal error C1083: Cannot open include file : 'afxwin.h' : No such file or direct
我正在尝试从 afxwin 动态加载一些功能,但我不确定我需要的 DLL 的名称。 谢谢 编辑:我正在寻找的类是 CFrameWnd 最佳答案 根据您要查找的特定类,它可以是以下任何一个 dll MF
问题: 如果我包含 afxwin.h 或 atlbase.h,我会得到一个 C1083(没有这样的文件或目录) 语言: C++ 使用的工具: 在 VS2010 Professional 中构建 使用
当我尝试将文件 VC++ 2005 运行到 VC++ 2008 时: 1>------ Build started: Project: canvas, Configuration: Debug Win
在 Visual Studio 2013 的 Windows 上,我认为 C++11 线程比线程更好,因为代码是平台无关的(编译器支持 C++11)。 找不到任何人讨论两者之间的区别。 想知道使用 a
所以,我正在尝试将一些旧代码移植到较新版本的 vs,所以我将项目的 sln 导入到我的 vs 2013 中,我得到了这个错误和其他一些错误,我已经解决了其他一些问题论坛。所以我知道这与 MFC(微软基
这个问题不太可能帮助任何 future 的访问者;它只与一个小的地理区域、一个特定的时间点或一个非常狭窄的情况相关,这些情况并不普遍适用于互联网的全局受众。为了帮助使这个问题更广泛地适用,visit
我正在将大量旧代码转移到我们的新框架工作中,这段旧代码的一部分使用了一些 MFC 类。 尝试编译类时出现错误: error C2504: 'CObject' : base class undefine
我是 VS2010 的新手,并尝试编译一个曾经在 VS2008 中工作过的项目。错误看起来很简单: stdafx.h(43): fatal error C1083: 无法打开包含文件: 'afxwin
我正在尝试让类负责在灰色背景上放置一些文本: 得分.h #pragma once class Score { public: Score(); ~Score(); void U
我尝试在安装了多类型 MFC 库的 visual studio 2015 MFC 上运行以前编写的 MFC c++ 代码。 但是,我这里仍然有 12 个关于缺少函数的错误: IntelliSense:
我是一名优秀的程序员,十分优秀!