user63898
user63898

Reputation: 30963

c++17 how can i get the CPU architecture cross platform

basically, I like to get the type of the CPU architecture the app is running on similar to node.js os.arch() or process.arch
it can be any C++/C library that i can link to my app but not Qt as i can't use it

update

this is what in 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.
     */

Upvotes: 2

Views: 675

Answers (1)

Aykhan Hagverdili
Aykhan Hagverdili

Reputation: 29995

You can't do that with standard C++. If you use Qt, QSysInfo::currentCpuArchitecture() does exactly what you want.

Upvotes: 1

Related Questions