Home > Mobile >  How to link with ntdll.lib using CMake?
How to link with ntdll.lib using CMake?

Time:10-21

I am using ntdll.lib functions in my code to set the system timer to a higher resolution.

But when I build my project I get this error:

...
.../bin/ld.exe: ... undefined reference to `__imp_NtSetTimerResolution'
collect2.exe: error: ld returned 1 exit status
...

How do I tell the linker to link with ntdll.lib in my CMake?

CodePudding user response:

This worked for me:

if (WIN32)
    target_link_libraries(executable ntdll)
endif()
  • Related