My code looks like this:
a.h
#include <QString>
namespace foo {
QString bar(QString a);
}
a.cc
#include "a.h"
namespace foo {
QString bar(QString a) { return QString(); }
}
The issue is in a.cc, QString might be taken as foo::QString, thus results in incomplete type compilation error, 'cause we didn't and never want to define a QString class in foo namespace.
Note that I have CMakeLists.txt containing below lines:
set(CMAKE_AUTOMOC ON)
find_package(Qt5 COMPONENTS widgets REQUIRED)
set(Qt_LIBRARIES Qt5::Widgets)
target_link_libraries(a Qt_LIBRARIES)
Any idea? Thanks!
Kuba Ober have pointed my problem exactly.
Actually I have a header file with 500 lines code. Say a.h looks like this
Note that the braces for foo is not closed. While due to too much lines and the compiler (VS2013) doesn't complaint it with red underscores, I just didn't detect it.
Then in a.cc, we have code like this

'Cause we include a.h in a.cc, even the std is wrapped under the suri namespace. Thus the QString might be wrapped under suri too, resulting in recognized as incomplete type compilation error.
This is the whole story. Thank you, guys!
