I have class Content in my project as follows:
#ifndef CONTENT_H
#define CONTENT_H
#include <QDateTime>
class Content
{
public:
//Content();
protected:
QString Sender;
QDateTime TimeSent;
QString Text;
QString Picture;
void SetText();
void SetImage();
void SetTime();
QString GetTimeSent();
};
#endif // CONTENT_H
When I compile the project, I get error in QT sources
This is compile output:
`
In file included from C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/pthread.h:69,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32/bits/gthr-default.h:35,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32/bits/gthr.h:148,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ext/atomicity.h:35,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/bits/shared_ptr_base.h:61,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/bits/shared_ptr.h:53,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/memory:77,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qobjectdefs_impl.h:17,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qobjectdefs.h:13,
from C:/Qt/6.6.2/mingw_64/include/QtGui/qwindowdefs.h:8,
from C:/Qt/6.6.2/mingw_64/include/QtWidgets/qwidget.h:8,
from C:/Qt/6.6.2/mingw_64/include/QtWidgets/qmainwindow.h:8,
from C:/Qt/6.6.2/mingw_64/include/QtWidgets/QMainWindow:1,
from ..LinkedIncompleteuserinfowindow.h:4,
from ..LinkedIncompleteuserinfowindow.cpp:1:
../LinkedIn/time.h:5:9: error: #include expects “FILENAME” or
5 | #include
| ^
In file included from C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include/pthread.h:69,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32/bits/gthr-default.h:35,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32/bits/gthr.h:148,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ext/atomicity.h:35,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/bits/ios_base.h:39,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/streambuf:41,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/bits/streambuf_iterator.h:35,
from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/iterator:66,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qcontainertools_impl.h:20,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qarraydataops.h:9,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qarraydatapointer.h:7,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qbytearray.h:11,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qmetatype.h:11,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qvariant.h:9,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qlocale.h:7,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qcalendar.h:10,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qdatetime.h:8,
from C:/Qt/6.6.2/mingw_64/include/QtCore/QDateTime:1,
from ..LinkedIncontent.h:3,
from ..LinkedIncontent.cpp:1:
../LinkedIn/time.h:5:9: error: #include expects “FILENAME” or
5 | #include
| ^
In file included from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/chrono:42,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qdebug.h:19,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qvariant.h:11,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qlocale.h:7,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qcalendar.h:10,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qdatetime.h:8,
from C:/Qt/6.6.2/mingw_64/include/QtCore/QDateTime:1,
from ..LinkedIncontent.h:3,
from ..LinkedIncontent.cpp:1:
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:60:11: error: ‘c
lock_t’ has not been declared in ‘::’
60 | using ::clock_t;
| ^~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:64:11: error: ‘clock’ has not been declared in ‘::’
64 | using ::clock;
| ^~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:65:11: error: ‘difftime’ has not been declared in ‘::’
65 | using ::difftime;
| ^~~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:66:11: error: ‘mktime’ has not been declared in ‘::’
66 | using ::mktime;
| ^~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:67:11: error: ‘time’ has not been declared in ‘::’
67 | using ::time;
| ^~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:68:11: error: ‘asctime’ has not been declared in ‘::’
68 | using ::asctime;
| ^~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:69:11: error: ‘ctime’ has not been declared in ‘::’
69 | using ::ctime;
| ^~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:70:11: error: ‘gmtime’ has not been declared in ‘::’
70 | using ::gmtime;
| ^~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:71:11: error: ‘localtime’ has not been declared in ‘::’
71 | using ::localtime;
| ^~~~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:72:11: error: ‘strftime’ has not been declared in ‘::’
72 | using ::strftime;
| ^~~~~~~~
In file included from C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/chrono:42,
from C:/Qt/6.6.2/mingw_64/include/QtCore/qobject.h:23,
from C:/Qt/6.6.2/mingw_64/include/QtWidgets/qwidget.h:9,
from C:/Qt/6.6.2/mingw_64/include/QtWidgets/qmainwindow.h:8,
from C:/Qt/6.6.2/mingw_64/include/QtWidgets/QMainWindow:1,
from ..LinkedIncompleteuserinfowindow.h:4,
from ..LinkedIncompleteuserinfowindow.cpp:1:
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:60:11: error: ‘clock_t’ has not been declared in ‘::’
60 | using ::clock_t;
| ^~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:64:11: error: ‘clock’ has not been declared in ‘::’
64 | using ::clock;
| ^~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:65:11: error: ‘difftime’ has not been declared in ‘::’
65 | using ::difftime;
| ^~~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:66:11: error: ‘mktime’ has not been declared in ‘::’
66 | using ::mktime;
| ^~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:67:11: error: ‘time’ has not been declared in ‘::’
67 | using ::time;
| ^~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:68:11: error: ‘asctime’ has not been declared in ‘::’
68 | using ::asctime;
| ^~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:69:11: error: ‘ctime’ has not been declared in ‘::’
69 | using ::ctime;
| ^~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:70:11: error: ‘gmtime’ has not been declared in ‘::’
70 | using ::gmtime;
| ^~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:71:11: error: ‘localtime’ has not been declared in ‘::’
71 | using ::localtime;
| ^~~~~~~~~
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/ctime:72:11: error: ‘strftime’ has not been declared in ‘::’
72 | using ::strftime;
| ^~~~~~~~
mingw32-m
ake[1]: *** [Makefile.Release:1677: release/content.o] Error 1
mingw32-make[1]: *** Waiting for unfinished jobs….
mingw32-make[1]: *** [Makefile.Release:1561: release/completeuserinfowindow.o] Error 1
mingw32-make[1]: Leaving directory ‘D:/Linked In/build-LinkedIn-Desktop_Qt_6_6_2_MinGW_64_bit-Profile’
mingw32-make: *** [Makefile:45: release] Error 2
09:00:43: The process “C:QtToolsmingw1120_64binmingw32-make.exe” exited with code 2.
Error while building/deploying project LinkedIn (kit: Desktop Qt 6.6.2 MinGW 64-bit)
When executing step “Make”
09:00:43: Elapsed time: 00:12.
`
I think problem is because of QDateTime class.