QT 创建器链接错误 1120
QT Creator Linking Error 1120
我一直在尝试在Qt Creator中编译我的项目。我已经多次运行 qmake 和清理,但仍然遇到链接错误。
moc_test.obj:-1: error: LNK2019: unresolved external symbol "private: void __cdecl Test::on_cboxMode_activated(class QString const &)" (?on_cboxMode_activated@Test@@AEAAXAEBVQString@@@Z) referenced in function "private: static void __cdecl Test::qt_static_metacall(class QObject *,enum QMetaObject::Call,int,void * *)" (?qt_static_metacall`enter code here`@Test@@CAXPEAVQObject@@W4Call@QMetaObject@@HPEAPEAX@Z)
这是项目文件
#-------------------------------------------------
#
# Project created by QtCreator 2013-10-25T13:51:21
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Test
TEMPLATE = app
SOURCES += test.cpp
main.cpp
HEADERS += test.h
FORMS += test.ui
这是我的cpp文件
#include "test.h"
#include "ui_test.h"
#include <QFileDialog>
Test::Test(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::Test)
{
ui->setupUi(this);
}
Test::~Test()
{
delete ui;
}
//********************************//
//**Browse and Select A Fit File**//
//********************************//
void Test::on_btnFitBrowse_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this,tr("Open File"), "/home/", tr("Comma Delimited (*.csv);;Text Files (*.txt);;All Files(*)"));
ui->txtFitEdit->setText(fileName);
}
//*********************************//
//**Browse and Select A Test File**//
//*********************************//
void Test::on_btnTestBrowse_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this,tr("Open File"), "/home/", tr("Comma Delimited (*.csv);;Text Files (*.txt);;All Files(*)"));
ui->txtTestEdit->setText(fileName);
}
//--------------------------------------------------------------------//
//----------------------------Model Window----------------------------//
//--------------------------------------------------------------------//
//***************//
//**Select Mode**//
//***************//
void Test::on_cboxMode_activated(int index)
{
//Auto Mode
if(index==0)
{
ui->rdoBestTMinMSE->setEnabled(false);
ui->rdoBestTMaxF->setEnabled(false);
}
//Manual Mode
else if(index==1)
{
ui->rdoBestTMinMSE->setEnabled(true);
ui->rdoBestTMaxF->setEnabled(true);
}
}
这是我的头文件
#ifndef TEST_H
#define TEST_H
#include <QMainWindow>
#include <QRadioButton>
namespace Ui {
class Test;
}
class Test : public QMainWindow
{
Q_OBJECT
public:
explicit Test(QWidget *parent = 0);
~Test();
private slots:
void on_btnFitBrowse_clicked();
void on_btnTestBrowse_clicked();
void on_cboxMode_activated(const QString &arg1);
void on_cboxMode_activated(int index);
private:
Ui::Test *ui;
};
#endif // TEST_H
我的目录结构如下所示
+---Test Qt
¦ +---build-Test-Desktop_Qt_5_1_1_MSVC2012_OpenGL_64bit-Debug
¦ ¦ +---debug
¦ ¦ +---release
¦ +---build-Test-Desktop_Qt_5_1_1_MSVC2012_OpenGL_64bit-Release
¦ ¦ +---debug
¦ ¦ +---release
¦ +---Test
很可能你有一个 Test::on_cboxMode_activated 将 QString& 带入 test.h 和 测试中.cpp你有带有 int 参数的方法。 如果不是这种情况,请也从test.h发布代码
相关文章:
- 警告处理为错误这里有什么问题
- "error: no matching function for call to"构造函数错误
- boost::进程间消息队列引发错误
- C++,OpenCV,尝试显示图像时"OpenCV(4.3.0) Error: Assertion failed (size.width>0 && size.height>0)"此错误
- 有关插入适配器的错误。[错误]请求从 'back_insert_iterator<vector<>>' 类型转换为非标量类型
- QT在错误的班级中寻找空位
- vector.resize()中的分配错误
- 代码在main()中运行,但在函数中出现错误
- 释放错误后堆使用
- (C++)分析树以计算返回错误值的简单算术表达式
- Project Euler问题4的错误解决方案
- 我的字符计数代码计算错误.为什么
- 从"int*"强制转换为"unsigned int"会丢失精度错误
- 尝试导入pybind-opencv模块时出现libgtk错误
- CMake项目Boost库错误:Boost/config/compiler/gcc.hpp:165:10:致命错误:cs
- C++错误LNK 1120关于TEMPLATES
- QT 创建器链接错误 1120
- VS10 C++-致命错误LNK 1120
- 决策搜索树中的链接错误2019和1120
- LNK 2019/1120我的头文件/源文件实践中的双重链接列表错误