c++ - 声明 QStringList 时出错

标签 c++ qt qstring

我有一个公共(public)功能:

void determineAction(QStringList tempL); // in header file

void CompArch::determineAction(QStringList tempL)
{


}

//in cpp file

我得到错误:

CompArch.cpp:127:6: error: ‘tempL’ has incomplete type
/usr/include/qt4/QtCore/qstring.h:77:7: error: forward declaration of ‘struct QStringList’

为什么会这样。

最佳答案

添加#include <QStringList>到 .cpp 文件的顶部。不完整的类型意味着你的类(QStringList)之前已经使用foward declaration命名过。 , 但其内容尚未公布。

关于c++ - 声明 QStringList 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12981868/

相关文章:

c++ - 在 C++ 中,当我将一个值传递给一个函数时,它是否总是转换为适当的类型?

c++ - 如何使用循环从 TEdit 中逐个获取文本

c - Linux 中的串口设置是永久的吗?

qt - QML:调整 ListView 页脚组件的大小以填充剩余空间

sql - QSqlQuery 准备语句 - 正确使用

qt - QString度数符号

c++ - 生成 std​​::string 的唯一 id

c++ - 更新 : program shows adress of fstream instead of the text file

Qt Creator 调试器进入 QString 代码

qt - 如何将 QJsonObject 转换为 QString