- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
在 Release模式下编译时出现以下错误。
1>d:\users\eyal\projects\code\yalla\core\src\runbox\win32\window.cpp : fatal error C1001: An internal error has occurred in the compiler.
1> (compiler file 'f:\dd\vctools\compiler\utc\src\p2\main.c', line 249)
1> To work around this problem, try simplifying or changing the program near the locations listed above.
1> Please choose the Technical Support command on the Visual C++
1> Help menu, or open the Technical Support help file for more information
1> link!RaiseException()+0x48
1> link!CxxThrowException()+0x65
1> link!std::_Xout_of_range()+0x1f
1> link!InvokeCompilerPass()+0x1b4e2
1> link!InvokeCompilerPass()+0x22efe
1> link!InvokeCompilerPass()+0x2332e
1> link!InvokeCompilerPass()+0x232f9
1> link!InvokeCompilerPass()+0x233cb
1> link!InvokeCompilerPass()+0x22b04
1> link!InvokeCompilerPass()+0x22d86
1> link!DllGetC2Telemetry()+0x115837
1>
1> 1>
1>LINK : fatal error LNK1257: code generation failed
我正在使用 VS2015 Update 2 RC。
我不确定,但也许这是优化器中的错误?
导致的代码如下:
窗口.h
class Window {
public:
Window();
~Window();
void show();
void hide();
private:
class NativeControl;
std::unique_ptr<NativeControl> _window;
};
窗口.cpp
class Window::NativeControl : public NativeWindow {
public:
NativeControl() : NativeWindow() { }
};
Window::Window()
: _window(std::make_unique<Window::NativeControl>()) {
}
Window::~Window() {
}
void Window::show()
{
_window->show(WindowShowMode::Show);
}
void Window::hide()
{
_window->show(WindowShowMode::Hide);
}
NativeWindow 是任何操作系统的 native 窗口。
这是使用 GCC 5.1 编译的工作代码: https://ideone.com/4YvjRK
只是做个笔记。
如果我删除继承并用类似这样的东西替换它。
class Window::NativeControl {
public:
void show(WindowShowMode showMode)
{
}
};
它会很好地工作!
下面是使用 GCC 5.1 编译的相同代码,没有继承: https://ideone.com/Mu0A42
导致此行为的原因似乎是从 NativeWindow 派生 NativeControl。
重现步骤如下:
1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\memory(1194): error C2338: can't delete an incomplete type 1> 1> 1>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\memory(1195): warning C4150: deletion of pointer to incomplete type 'Yalla::Window::NativeControl'; no destructor called 1>
d:\Users\Eyal\Projects\Code\Yalla\core\src\runbox\include\window.h(13): note: see declaration of 'Yalla::Window::NativeControl' 1>
window.cpp 1> 1>Build FAILED.
有趣的是重建似乎可以解决问题!
我想要实现的基本上是在不同的文件中实际实现 NativeWindow,主要是为了简单而不是为了可重用性。
我想与其在继承中这样做,这可能会混淆 unique_ptr 模板,我还可以通过组合来做到这一点,并通过 getter 公开 NativeWindow 的实例,它可能 工作,但问题是是否有更好的方法来做到这一点?
我在很长一段时间没有接触过 C++ 之后重新学习它,所以如果我做的某些事情没有意义,请告诉我!
更新:
C++ 标准说:
unique_ptr的模板参数T可能是一个不完整的类型。
我在 Herb Sutter 的 blog 中找到了一篇关于它的帖子.
最佳答案
类似的错误
(编译器文件“f:\dd\vctools\compiler\utc\src\p2\main.c”,第 255 行)
已修复更改 Properties->Linker->Optimization->Link Time Code Generation
从 /LTCG:incremental
到 /LTCG
Studio 2015 更新 3
关于C++ fatal error C1001 : An internal error has occurred in the compiler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36005206/
这个问题在这里已经有了答案: How to make a property protected AND internal in C#? (8 个答案) 关闭 9 年前。 我需要声明一个既受又 内部保
我对在 Kotlin 1.3 中使用 Strings.isNullOrEmpty 导入 jdk.internal.joptsimple.internal.Strings.isNullOrEmpty 的
我有一个项目,实习生单元测试应该位于与被测源代码不同的目录树中。有点像这样: projectRoot projectRoot/src projectRoot/tests projectRoot/tes
如何在功能测试中访问浏览器的主要 JavaScript 范围?例如,我想获取对 Dojo 小部件的引用并检查它的属性。例如,在浏览器 JavaScript 控制台中,我可以运行: dijit.
public class TestClass { protected internal int FieldA; internal protected int FieldB; }
我想创建一个内部自动属性: internal bool IP { get; protected internal set; } 我认为可以使 setter protected 或 protected
java.lang.NoSuchMethodError: okhttp3.internal.Internal.initializeInstanceForTests() When creating a
我正在尝试使用 intern 来测试在 node.js 下运行的 dojo 应用程序 我的 intern.js 配置文件是这样的: define({ loader: {
我在 Raspbian wheezy 上的 nginx 1.2.1-2.2 有点问题。我认为它是在我更改站点可用/默认文件中的索引后开始的。以下是相关文件: nginx.conf user www-d
我在尝试加载 Visual studio 2012 时遇到了此错误,遇到了异常。这可能是由扩展引起的,并且在 C:\Users\~\AppData 中给出了附加信息的位置\Roaming\Micros
我正在将一个项目迁移到 Java9,在我切换到新的 Java 版本后,测试开始失败,看起来 PowerMock 正在尝试访问一些它无法访问的类。 Tests run: 1, Failures: 0,
该触发器用于检测进度中的顺序是否已更新,并有助于更新进度的概览状态和完成时间。 但是当发生内部错误时,它并不总是有效,如下所示: Error: 13 INTERNAL: An internal err
当我尝试将包含一些 JavaScript 的项目导入工作区时(使用 Eclipse 的 Neon.M6 版本),出现此错误: eclipse.buildId=4.6.0.I20160317-0200
我在尝试访问 FullContact API 服务器时收到此错误。我正在使用 okhttp 2.7.5 和 okhttp-urlconnection 2.7.5 以及改造 1.9.0。 Caused
当我试图读取一个以前版本的 pandas 保存的 pickle 文件时,它产生了一个 ImportError。 ImportError: No module named 'pandas.core.in
我正在将一个项目迁移到 Java9,在我切换到新的 Java 版本后测试开始失败,似乎 PowerMock 正在尝试访问它无法访问的一些类。 Tests run: 1, Failures: 0, Er
我正在尝试设置 Lumen - 建立在 Laravel 组件之上的“微框架”。服务器端有 nginx + php-fpm。 这是我的 nginx 配置: server { server_nam
在我们的项目中,我们决定在我们的项目中使用最新的 fmt 版本 (6.2.0) 并主要使用 printf 功能,因为我们在广泛使用 printf 的地方进行日志记录。 我使用 fmt 包中包含的 CM
我正在使用 Mockito jar 为 Groovy 编写 Junit 测试用例,但它给了我以下异常: java.lang.NoSuchMethodError: org.mockito.interna
我们的应用程序使用 Google 集合中的 MapMaker 类,并且我们遇到了以下异常,但仅限于使用 webstart 的 OS X 10.4。从应用程序包启动时以及在 OS X 10.5 和 Wi
我是一名优秀的程序员,十分优秀!