none
VS2015 C++, Support for GetTickCount and GetCurrentDirectory in Desktop Console application?

    Question

  • Apparently a Community version of VS2015 C++ Console project does not have access to GetCurrentTicks() and GetCurrentDirectory() ?  Can't seem to find: 

       #1 - a system header file (that doesn't cause a runaway set of header-related errors) nor 

       #2 - a system lib file that exports those functions (such as kernel32.lib)

    Anyone shed light on this matter?

    Thanks,


    GeraldH



    • Edited by GeraldH Saturday, May 28, 2016 5:46 AM
    Saturday, May 28, 2016 5:45 AM

Answers

All replies

  • Apparently a Community version of VS2015 C++ Console project does not have access to GetCurrentTicks()

    Did you mean GetTickCount
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms724408%28v=vs.85%29.aspx
    ?

    and GetCurrentDirectory()

    For both, you should only need to

    #include <windows.h>

    and the kernel32.lib should be automatically referenced for the linker
    unless you've explicitly changed the linker settings for your project
    to exclude it.

    Dave

    • Marked as answer by GeraldH Sunday, May 29, 2016 5:42 AM
    Saturday, May 28, 2016 8:13 AM
  • Thanks Dave,

      First you are correct, I meant GetTickCount() - have no idea why I typed GetCurrentTick !!

    You response sent me down a different path - was using an existing Console project from a supplier which used C (not C++) files.  Thought it had to do with C++  mangling but that was not the case.

    Succeeds as you stated with a newly VS2015-created Console project.   I think I shot myself in the foot by trying to avoid including windows.h (which I was concerned would open Pandora's box for a C-based Console project).

    Worked backwards from there - the C-based Console app now also compiles & links.  Also defined WIN32_LEAN_AND_MEAN.  

    Thanks again!!


    GeraldH

    Sunday, May 29, 2016 5:54 AM
  • Hi my friends,

    @Dave, thank you so much for providing such a useful solution,

    @GeraldH, it's really kind of you for sharing your result and develop experience here.

    Have a nice day:)

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.

    Click HERE to participate the survey.

    Monday, May 30, 2016 6:21 AM
    Moderator
  • >I think I shot myself in the foot by trying to avoid including windows.h (which I was concerned would open Pandora's box for a C-based Console project).

    Ah, it's always easier to go with the flow.

    I'm glad it helped anyway.

    Dave

    Monday, May 30, 2016 8:04 AM