I want to use the cross-platform function sleep. In one of the questions such a solution was proposed. Since qt has constants such as Q_OS_WIN32 and Q_OS_LINUX , I decided to use them rather than define some of my own.
The problem is that for some reason these constants are not seen (both blocks are gray), and if you set DEFINES += Q_OS_WIN32 in the .pro file, you DEFINES += Q_OS_WIN32 lot of errors about defining the override, i.e. once it is still determined, it just happens after the file is processed with the function.
I tried to include it as low as possible, but it does not help.
I tried to include at the very top of the main QtGlobal, since the constants are there, but it also did not help. How to solve this problem?
|
1 answer
As a result, the problem was solved by connecting the <QtGlobal> file directly to the header file with this function (and not to the very top of main, as described in the question).
I have no idea how this could affect, perhaps, in the process of optimizing the code, the order of defines was changed, but I would not risk saying this with confidence.
|
QThread::msleep()does not suit? If you use Qt, use its features to the maximum - Bearded Beaver