在 <intrin.h> 中使用 __cpuid() 时出现链接错误?



错误显示:

error LNK2019: unresolved external symbol WinCPUID_Init referenced in function 
"public: static void __cdecl CCapturer::GetCPUVendorId(void)" 
 (?GetCPUVendorId@CCapturer@@SAXXZ)

但它没有指出我应该在MSDN _cpuid 中添加哪个库

如何解决?

请在此处查看我对您问题的回答:http://social.msdn.microsoft.com/Forums/vstudio/en-US/b80068ac-e17b-4f21-85fd-1d87fdc9b6b6/link-error-when-using-the-cpuid-in-intrinh?forum=msbuild

显然,它也被fddshow试用安装程序使用(我不知道那是什么),并在WinCPUID.dll 中定义

external     'WinCPUID_Init@files:WinCPUID.dll cdecl';

我在这里找到了WinCPUID_Init符号的匹配项:

http://code.google.com/p/notepad2-mod/source/browse/branches/inno/distrib/cpu_detection.iss?r=616

代码头上写着

// The script is taken from the ffdshow-tryouts installer
// http://sourceforge.net/projects/ffdshow-tryout/

以及后来的

// functions to detect CPU
function WinCPUID_Init(msGetFrequency: Integer; var pInfo: TCPUInfo): Integer;
external     'WinCPUID_Init@files:WinCPUID.dll cdecl';
// function to get system information
procedure GetSystemInfo(var lpSystemInfo: TSystemInfo); external 'GetSystemInfo@kernel32.dll stdcall';

procedure CPUCheck();
var
  CPUInfo: TCPUInfo;
begin
  WinCPUID_Init(0, CPUInfo);
  if (CPUInfo.bIsInitialized = 0) then begin
    // something went wrong
  end
  else begin
    if (CPUInfo.bSSE_Supported  = 1) then begin
      cpu_sse  := true;
    end;
    if (CPUInfo.bSSE2_Supported = 1) then begin
      cpu_sse2 := true;
    end;
  end;
end;

相关内容

  • 没有找到相关文章

最新更新