How can I find the gpu and cpu name in Qt c++

Asked

Viewed 63 times

0

Any of these solutions suit me, I first tested a system management code to try to find the name of the gpu and cpu, but give this error to me in visual studio, the compiler seems not to accept clr, and I am using Qt in the project with the compiler msvs2017 64bit.

Gravidade   Código  Descrição   Projeto Arquivo Linha   Estado de Supressão
Erro    D8016   opções de linha de comando '/clr' e '/EHs' são incompatíveis    Denoiser    C:\Git\Denoiser-Script\src\cl   1

Another problem is that the proper api of Qt does not identify the cpu name or gpu, I ended up not finding what I wanted. So what would be the solution?

code that I used

using namespace System;
using namespace System::Management;

void printHardwareInfo(String^ HardwareClass, String^ propetyName)
{
    ManagementObjectSearcher^ searcher = gcnew ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM" + HardwareClass);
    ManagementObjectCollection^ collection = searcher->Get();

    for each (ManagementObjectSearcher^ object in collection)
    {
        Console::WriteLine(object[propetyName]->ToString());
    }
}

1 answer

0

The CLR command causes your code to reference the Runtime of msvc(vcredist) installed dynamically equivalent to '/MD', this acts as a proxy between your code and the CRT. It’s hard to say exactly what this proxy does, but I think it acts as an interface for allocations in heap manager, Garbage Collector and threads. If you statically link to CRT, the proxy will not be able to intercept your calls to libraries at runtime.

The CLR has several restrictions including the use of/EH exceptions, as the CLR implies redundantly. The compiler will generate an error if/Ehs is used after/CLR'.

If you want to make your application static, you need to use the command '/MT'. However, you already have another problem because Qt is dynamically linked. Apart from the licensing part of this framework, you would need to recompile the source code of this framework in a static way using '/MT' since by default it is used '/MD'.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.