此问题在此处已有答案:
CPUID implementations in C++(3个答案)
两年前关闭。
我尝试用下面的代码读取cpuid信息,但不起作用。我使用的是Visual Studio 2010:
#include "stdafx.h"
#include <stdio.h>
int main()
{
int a, b;
for (a = 0; a < 5; a++)
{
__asm__("cpuid"
:"=a"(b) // EAX into b (output)
:"0"(a) // a into EAX (input)
:"%ebx","%ecx","%edx"); // clobbered registers
printf("The code %i gives %i\n", a, b);
}
return 0;
}
字符串
它是这么说的:
'project_scs.exe': Loaded 'C:\Users\myUser\Documents\Visual Studio 2010\Projects\project_scs\Debug\project_scs.exe', Symbols loaded.
'project_scs.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Symbols loaded (source information stripped).
'project_scs.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Symbols loaded (source information stripped).
'project_scs.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Symbols loaded (source information stripped).
'project_scs.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'project_scs.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
The thread 'Win32 Thread' (0x2190) has exited with code -1073741510 (0xc000013a).
The program '[8828] project_scs.exe: Native' has exited with code -1073741510 (0xc000013a).
型
有人能告诉我怎么做才能让它运行吗?谢谢
2条答案
按热度按时间ssm49v7z1#
主要问题是:你使用了AT&T的Intel Core,因为它用于GCC。但是,Visual Studio需要Intel Core。看看我下面的例子,看看其中的链接:
字符串
jv4diomz2#
这是我使用的。它应该与MSVC,ICC,GCC和Clang一起工作。
字符串