c ++ 17如何获得跨平台的CPU架构

时间:2021-02-04 15:59:32

标签: c++ cpu-architecture

基本上,我喜欢获取运行应用程序的 CPU 架构的类型 类似于 node.js os.arch()process.arch
它可以是我可以链接到我的应用程序的任何 C++/C 库 但不是 Qt,因为我不能使用它

更新

这是 node.js 中的内容

 function arch(): string;
    /**
     * Returns a string identifying the kernel version.
     * On POSIX systems, the operating system release is determined by calling
     * [uname(3)][]. On Windows, `pRtlGetVersion` is used, and if it is not available,
     * `GetVersionExW()` will be used. See
     * https://en.wikipedia.org/wiki/Uname#Examples for more information.
     */

1 个答案:

答案 0 :(得分:1)

使用标准 C++ 无法做到这一点。如果您使用 Qt,则 QSysInfo::currentCpuArchitecture() 完全符合您的要求。

相关问题