如何使用 CMake link 和 ntdll.lib?
How to link with ntdll.lib using CMake?
我在我的代码中使用 ntdll.lib
函数来将系统计时器设置为更高分辨率。
但是当我构建我的项目时,我得到了这个错误:
...
.../bin/ld.exe: ... undefined reference to `__imp_NtSetTimerResolution'
collect2.exe: error: ld returned 1 exit status
...
如何在我的 CMake 中使用 ntdll.lib
告诉 linker link?
这对我有用:
if (WIN32)
target_link_libraries(executable ntdll)
endif()
我在我的代码中使用 ntdll.lib
函数来将系统计时器设置为更高分辨率。
但是当我构建我的项目时,我得到了这个错误:
...
.../bin/ld.exe: ... undefined reference to `__imp_NtSetTimerResolution'
collect2.exe: error: ld returned 1 exit status
...
如何在我的 CMake 中使用 ntdll.lib
告诉 linker link?
这对我有用:
if (WIN32)
target_link_libraries(executable ntdll)
endif()