PDA

View Full Version : Can't find QElapsedTimer in VS2015



CodeSlapper
29th November 2017, 21:52
I made a project in VS 2015 with Qt 5.8. I can use QTimer, but I can't use QElapsedTimer.

I have another project that can use QTimer and QElapsedTimer. I can't figure out the difference.

When it works I can see QElapsedTimer in Additional Dependencies. When it doesn't, I cannot.

Both QTimer and QElapsedTimer are located in the Qt\Core directory.

Is there a prepoccessor or project setting I am missing?

d_stranz
29th November 2017, 22:26
I can't use QElapsedTimer

What do you mean, you can't "use" it? Do you get a compiler error, a linker error, or does the code not run in the way you expect it to run?

Probably you will need to post the code where you are trying to "use" it.

CodeSlapper
29th November 2017, 23:26
If I put this code below it changes color and I can find the definition for it.


QTimer *test;
If I try this code below it never changes color and I can't find the definition.


QElapsedTimer *blah;
If I try to compile I get an undeclared identifier error.

In my other project they both work and it compiles.

d_stranz
29th November 2017, 23:41
I get an undeclared identifier error.

And do you have a

#include <QElapsedTimer>
statement at the top of your .cpp file? And maybe a forward declaration

class QElapsedTimer;
in your .h file somewhere before you declare this variable?