Results 1 to 4 of 4

Thread: Can't find QElapsedTimer in VS2015

  1. #1
    Join Date
    Mar 2017
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Can't find QElapsedTimer in VS2015

    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?

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,769
    Thanks
    262
    Thanked 773 Times in 763 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Can't find QElapsedTimer in VS2015

    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.
    Last edited by d_stranz; 29th November 2017 at 23:56.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Mar 2017
    Posts
    9
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Can't find QElapsedTimer in VS2015

    If I put this code below it changes color and I can find the definition for it.

    Qt Code:
    1. QTimer *test;
    To copy to clipboard, switch view to plain text mode 
    If I try this code below it never changes color and I can't find the definition.

    Qt Code:
    1. QElapsedTimer *blah;
    To copy to clipboard, switch view to plain text mode 
    If I try to compile I get an undeclared identifier error.

    In my other project they both work and it compiles.

  4. #4
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,769
    Thanks
    262
    Thanked 773 Times in 763 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Can't find QElapsedTimer in VS2015

    I get an undeclared identifier error.
    And do you have a
    Qt Code:
    1. #include <QElapsedTimer>
    To copy to clipboard, switch view to plain text mode 
    statement at the top of your .cpp file? And maybe a forward declaration
    Qt Code:
    1. class QElapsedTimer;
    To copy to clipboard, switch view to plain text mode 
    in your .h file somewhere before you declare this variable?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. How to set QElapsedTimer :: ClockType TickCounter?
    By Excalibur921 in forum Newbie
    Replies: 0
    Last Post: 3rd November 2017, 18:18
  2. How to compile Qt 5.8 statically with PostgreSQL plugin in VS2015
    By moabi in forum Installation and Deployment
    Replies: 0
    Last Post: 20th March 2017, 08:17
  3. Vs2015
    By Alundra in forum Qt Programming
    Replies: 1
    Last Post: 30th July 2015, 11:43
  4. Alternative to QElapsedTimer in old Qt version
    By Asperamanca in forum Qt Programming
    Replies: 3
    Last Post: 27th February 2012, 11:08
  5. Replies: 2
    Last Post: 22nd February 2012, 19:56

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.