QT创建者:简单程序未解决的外部符号和外部符号错误
QT Creator: Unresolved External Symbol and Externals Error for Simple Program
我处于学习Q创建者的阶段,并且正在关注教程,当我尝试编译时,我被返回这些错误:
moc_mainwindow.obj:-1:错误:lnk2019:未解决的外部符号&quot&quot&quot&quot" void __cdecl mainwindow :: on_actionnew_window_trigned(void(&quot(?(?qt_static_metacall@mainwindow @@ caxpeavqobject @@ w4call@qmetaobject @@@@@hpeapeax@z(
和:
debug program5--displayingdifferentwindowtypes.exe:-1:错误:lnk1120:1个未解决的外部
我还有其他一些程序可以毫无问题,但是我在该程序中所做的不同之处在于我创建了一种新表单,以便我可以测试创建模态且无度的窗口。
我已经尝试了右键单击项目文件,然后清洁,构建QMAKE和运行 - 我已经在这里看到了解决方案。
这是我相信可能引起问题的代码,但我不确定。
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "modaldialog.h" //Need to include for each new file you make; Basic C++ rules apply.
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//This sets the main portion of the window to whatever Qobject is inside of it.
setCentralWidget(ui->plainTextEdit);
}
MainWindow::~MainWindow()
{
delete ui;
}
//Creates a Dialog Window that cannot be clicked out out of unless closed.
void MainWindow::on_actionModal_Window_triggered()
{
ModalDialog mDialog;
mDialog.setModal(true);
mDialog.exec();
}
如果您需要任何其他文件,请告诉我,但这是我实际添加代码的唯一文件。
您在CPP文件中缺少MainWindow::on_actionNew_Window_triggered()
的定义。
相关文章:
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- 未解析的外部符号_MsiLocateComponentW@12.
- 在C++中使用 gRPC 时未解析的外部符号
- LibPrivoxy: 未解析的外部符号 __declspec(dllimport) int __stdcall Sta
- 尝试从 XamlApplication 编译 C++/WinRT 空白应用程序时,我收到未解析的外部符号 winrt_make_*
- 我收到错误LNK2001:未解析的外部符号(C++代码)
- 可视抽象类 c++(错误 LNK 2001:未解析的外部符号)
- 如何摆脱C++中未解析的外部符号"private: static char"错误?
- 当 lib 已添加到其他依赖项时,如何在 VS 中调试未解析的外部符号错误
- 仅在少数方法(静态或共享库)中解析的外部符号
- 未解析的外部符号"__declspec(dllimport)与 Spdlog c++ 库
- 函数 _main (OPENGL C++) 中引用的未解析的外部符号 ________
- 错误LNK2019未解析的外部符号"public: __thiscall SLinkList<char>::SLinkList<char>(void)"
- 使用静态 constexpr 成员的未解析外部符号
- 引入参数化构造函数后显示 LNK 2019 未解析外部符号的代码错误
- Dlib LNK2001未解析的外部符号USER_ERROR__consistent_build_configurati
- 矛盾的未解决的外部符号+未使用的库与VS2017和FFMPEG 4
- 链接器错误:切换到unicode生成给出:未解析的外部符号WinMain
- 类模板上一个特定函数的未解析外部符号
- LNK2001:未解析的外部符号public:static类std::vector