Amre
Amre

Reputation: 1680

Error when declaring QStringList

I have a public function:

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

void CompArch::determineAction(QStringList tempL)
{


}

//in cpp file

I get the error:

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

any ideas why this might be.

Upvotes: 4

Views: 6302

Answers (2)

tomahh
tomahh

Reputation: 13651

add #include <QStringList> to the top of your .cpp file. Incomplete type means that your class (QStringList) has already been named before, using foward declaration, but the content of it has not been declared.

Upvotes: 11

bert-jan
bert-jan

Reputation: 968

Incomplete type means that the compiler has seen QStringList as class, but did not see the body of the QStringList class header. It looks like you must include a header that does contain the class header body for QStringList.

Upvotes: 1

Related Questions