【问题标题】:How to fix "c1001: An internal error..." in compiler read-only file?如何修复编译器只读文件中的“c1001:内部错误...”?
【发布时间】:2015-06-22 21:52:51
【问题描述】:

我是 Qt 的新手,并且使用创建者 (v3.4.1) 设计了我的第一个 GUI。我已经编写了程序的一些内容,但现在我只想测试 GUI。当我尝试构建项目时,出现错误:

C1001:编译器发生内部错误。

C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0:61

xmemory()这里指向的代码如下:注意:第61行是具体的错误行。

58    template<> inline
59      void _Destroy(char *)
60      {   // destroy a char (do nothing)
61      }

作为新手,我什至不确定这行代码在我的项目上下文中应该做什么。 任何见解或解决方案将不胜感激。谢谢

编辑: 好的,我找到了对问题的一些解释但是我不确定如何实施其简化的修复建议,因为我没有编码,创建者做了。无论如何,这就是它所说的:

\CPSC542_-_Gradebook" -I"." -I"D:\Qt\Qt5.4.2\5.4\msvc2013_64\include" -I"D:\Qt\Qt5.4.2\5.4\msvc2013_64\include\QtWidgets" -I"D:\Qt\Qt5.4.2\5.4\msvc2013_64\include\QtGui" -I"D:\Qt\Qt5.4.2\5.4\msvc2013_64\include\QtANGLE" -I"D:\Qt\Qt5.4.2\5.4\msvc2013_64\include\QtCore" -I"debug" -I"." -I"D:\Qt\Qt5.4.2\5.4\msvc2013_64\mkspecs\win32-msvc2013" -Fodebug\ @C:\Users\Louis\AppData\Local\Temp\moc_mainwindow.obj.77700.15.jom
moc_mainwindow.cpp
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xmemory0(61) : fatal error C1001: An internal error has occurred in the compiler.
(compiler file 'msc1.cpp', line 1325)
 To work around this problem, try simplifying or changing the program near the locations listed above.
Please choose the Technical Support command on the Visual C++ 
 Help menu, or open the Technical Support help file for more information
Internal Compiler Error in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe.  You will be prompted to send an error report to Microsoft later.
jom: C:\Users\Louis\Desktop\build-CPSC542_-_Gradebook-Desktop_Qt_5_4_2_MSVC2013_64bit-Debug\Makefile.Debug [debug\main.obj] Error 1
jom: C:\Users\Louis\Desktop\build-CPSC542_-_Gradebook-Desktop_Qt_5_4_2_MSVC2013_64bit-Debug\Makefile.Debug [debug\mainwindow.obj] Error 1
jom: C:\Users\Louis\Desktop\build-CPSC542_-_Gradebook-Desktop_Qt_5_4_2_MSVC2013_64bit-Debug\Makefile.Debug [debug\moc_mainwindow.obj] Error 1
jom: C:\Users\Louis\Desktop\build-CPSC542_-_Gradebook-Desktop_Qt_5_4_2_MSVC2013_64bit-Debug\Makefile [debug] Error 2
15:22:56: The process "D:\Qt\Qt5.4.2\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project CPSC542_-_Gradebook (kit: Desktop Qt 5.4.2 MSVC2013 64bit)
When executing step "Make"
15:22:56: Elapsed time: 00:01.

编辑 2: 好的,这就是项目中的所有代码。它基本上是一个空白项目,但在 3 台不同的计算机上出现与上述相同的错误(只是彻底)。

ma​​inwindow.h:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H

ma​​in.cpp

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

ma​​inwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}

ma​​inwindow.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>1146</width>
    <height>629</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralWidget"/>
  <widget class="QMenuBar" name="menuBar">
   <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <width>1146</width>
     <height>21</height>
    </rect>
   </property>
  </widget>
  <widget class="QToolBar" name="mainToolBar">
   <attribute name="toolBarArea">
    <enum>TopToolBarArea</enum>
   </attribute>
   <attribute name="toolBarBreak">
    <bool>false</bool>
   </attribute>
  </widget>
  <widget class="QStatusBar" name="statusBar"/>
 </widget>
 <layoutdefault spacing="6" margin="11"/>
 <resources/>
 <connections/>
</ui>

【问题讨论】:

  • 恭喜您遇到了编译器错误。请访问Microsoft Connect并举报。
  • @CaptainObvlious 谢谢。在您提出建议后,我在创建者中找到了上述解释(请参阅编辑)。我不得不在 Qt creator 中搜索它。我试试 MS 路线,然后绕回来。
  • 所以就举报?我对此无能为力吗?它说要简化代码,但它都是 Qt 创建者代码。 (我在没有代码的情况下重新创建了它......同样的问题)。
  • 如果您希望我们帮助修复它,您需要将其减少为 MCVE,并使用导致错误发生的代码并将其编辑到您的帖子中。从那里我们也许可以帮助您将其简化为一段有效的代码,否则您将不得不等待 MS 修复其损坏的代码。
  • @CaptainObvlious 好的,我会发布代码。但基本上这个错误发生在一个空项目上。为了得到一个 MCVE,我开始一个一个地删除 GUI 控件,直到整个东西都是空的(除了空白窗口)。您可以立即查看上面留下的所有内容。再次感谢。

标签: c++ qt user-interface


【解决方案1】:

所以,我只是卸载/重新安装了所有东西(Qt Creator、VS2013、Win 调试工具)。这很痛苦(因为他们都必须重新下载),但它奏效了。如果其他人有此问题,请先重新启动 Windows。然后检查您的构建设置、编译器设置,然后解构您的项目(以防出现错误代码)。如果这不起作用,那么做我最终必须做的事情并卸载/重新安装所有东西。希望它不会到那个地步。谢谢大家。

【讨论】:

    猜你喜欢
    • 2011-08-26
    • 1970-01-01
    • 1970-01-01
    • 2021-04-06
    • 1970-01-01
    • 1970-01-01
    • 2020-09-16
    • 1970-01-01
    相关资源
    最近更新 更多