声明QStringList时出错

Amr*_*mre 3 c++ qstring qt

我有一个公共职能:

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

void CompArch::determineAction(QStringList tempL)
{


}

//in cpp file
Run Code Online (Sandbox Code Playgroud)

我收到错误:

CompArch.cpp:127:6: error: ‘tempL’ has incomplete type
/usr/include/qt4/QtCore/qstring.h:77:7: error: forward declaration of ‘struct QStringList’
Run Code Online (Sandbox Code Playgroud)

任何想法为什么会这样.

tom*_*ahh 10

添加#include <QStringList>到.cpp文件的顶部.不完整类型意味着您的类(QStringList)之前已经使用foward声明命名,但它的内容尚未声明.