lfreist / hwinfo Goto Github PK
View Code? Open in Web Editor NEWcross platform C++ library for hardware information (CPU, RAM, GPU, ...)
License: MIT License
cross platform C++ library for hardware information (CPU, RAM, GPU, ...)
License: MIT License
It would be awesome if a precompiled release would be provided.. it could even be done through github actions.. Thx!
Hello,
I am trying to build HWinfo with gcc13.2.0 Mingw64 win10 x86 platform.
And I have got the linker issue:
[build] [100%] Linking CXX executable HWExample.exe
[build] C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: ../../lib/libHWinfo.a(wmi_wrapper.cpp.obj):wmi_wrapper.cp:(.text+0xc8): undefined reference to `_com_util::ConvertStringToBSTR(char const)'*
Is it possible to build HWinfo windows version and access WMI without visual studio and its libraries?
@lfreist While earlier version has been fixed #26 (comment) – now we are back to a broken build:
[ 44%] Building CXX object src/CMakeFiles/HWinfo.dir/apple/os.cpp.o
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/build/src && /opt/local/bin/g++-mp-12 -I/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include -pipe -Os -fpermissive -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -arch ppc -mmacosx-version-min=10.6 -MD -MT src/CMakeFiles/HWinfo.dir/apple/os.cpp.o -MF CMakeFiles/HWinfo.dir/apple/os.cpp.o.d -o CMakeFiles/HWinfo.dir/apple/os.cpp.o -c /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/os.cpp
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:18:13: error: no declaration matches 'std::string hwinfo::RAM::getVendor()'
18 | std::string RAM::getVendor() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:18:13: note: no functions named 'std::string hwinfo::RAM::getVendor()'
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:13:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/ram.h:10:7: note: 'class hwinfo::RAM' defined here
10 | class RAM {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:24:13: error: no declaration matches 'std::string hwinfo::RAM::getName()'
24 | std::string RAM::getName() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:24:13: note: no functions named 'std::string hwinfo::RAM::getName()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/ram.h:10:7: note: 'class hwinfo::RAM' defined here
10 | class RAM {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:30:13: error: no declaration matches 'std::string hwinfo::RAM::getModel()'
30 | std::string RAM::getModel() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:30:13: note: no functions named 'std::string hwinfo::RAM::getModel()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/ram.h:10:7: note: 'class hwinfo::RAM' defined here
10 | class RAM {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:36:13: error: no declaration matches 'std::string hwinfo::RAM::getSerialNumber()'
36 | std::string RAM::getSerialNumber() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:36:13: note: no functions named 'std::string hwinfo::RAM::getSerialNumber()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/ram.h:10:7: note: 'class hwinfo::RAM' defined here
10 | class RAM {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:42:9: error: no declaration matches 'int64_t hwinfo::RAM::getTotalSize_Bytes()'
42 | int64_t RAM::getTotalSize_Bytes() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:42:9: note: no functions named 'int64_t hwinfo::RAM::getTotalSize_Bytes()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/ram.h:10:7: note: 'class hwinfo::RAM' defined here
10 | class RAM {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:51:9: error: no declaration matches 'int64_t hwinfo::RAM::getAvailableMemory()'
51 | int64_t RAM::getAvailableMemory() { return -1; }
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/ram.cpp:51:9: note: no functions named 'int64_t hwinfo::RAM::getAvailableMemory()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/ram.h:10:7: note: 'class hwinfo::RAM' defined here
10 | class RAM {
| ^~~
make[2]: *** [src/CMakeFiles/HWinfo.dir/apple/ram.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:13:13: error: no declaration matches 'std::string hwinfo::MainBoard::getVendor()'
13 | std::string MainBoard::getVendor() {
| ^~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:13:13: note: no functions named 'std::string hwinfo::MainBoard::getVendor()'
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:8:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/mainboard.h:13:7: note: 'class hwinfo::MainBoard' defined here
13 | class MainBoard {
| ^~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:19:13: error: no declaration matches 'std::string hwinfo::MainBoard::getName()'
19 | std::string MainBoard::getName() {
| ^~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:19:13: note: no functions named 'std::string hwinfo::MainBoard::getName()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/mainboard.h:13:7: note: 'class hwinfo::MainBoard' defined here
13 | class MainBoard {
| ^~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:25:13: error: no declaration matches 'std::string hwinfo::MainBoard::getVersion()'
25 | std::string MainBoard::getVersion() {
| ^~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:25:13: note: no functions named 'std::string hwinfo::MainBoard::getVersion()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/mainboard.h:13:7: note: 'class hwinfo::MainBoard' defined here
13 | class MainBoard {
| ^~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:31:13: error: no declaration matches 'std::string hwinfo::MainBoard::getSerialNumber()'
31 | std::string MainBoard::getSerialNumber() {
| ^~~~~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/mainboard.cpp:31:13: note: no functions named 'std::string hwinfo::MainBoard::getSerialNumber()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/mainboard.h:13:7: note: 'class hwinfo::MainBoard' defined here
13 | class MainBoard {
| ^~~~~~~~~
make[2]: *** [src/CMakeFiles/HWinfo.dir/apple/mainboard.cpp.o] Error 1
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:25:5: error: no declaration matches 'int hwinfo::CPU::currentClockSpeed_kHz()'
25 | int CPU::currentClockSpeed_kHz() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:25:5: note: no functions named 'int hwinfo::CPU::currentClockSpeed_kHz()'
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:18:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:31:13: error: no declaration matches 'std::string hwinfo::CPU::getVendor()'
31 | std::string CPU::getVendor() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:31:13: note: no functions named 'std::string hwinfo::CPU::getVendor()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:47:13: error: no declaration matches 'std::string hwinfo::CPU::getModelName()'
47 | std::string CPU::getModelName() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:47:13: note: no functions named 'std::string hwinfo::CPU::getModelName()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:88:5: error: no declaration matches 'int hwinfo::CPU::getNumPhysicalCores()'
88 | int CPU::getNumPhysicalCores() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:88:5: note: no functions named 'int hwinfo::CPU::getNumPhysicalCores()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:142:5: error: no declaration matches 'int hwinfo::CPU::getNumLogicalCores()'
142 | int CPU::getNumLogicalCores() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:142:5: note: no functions named 'int hwinfo::CPU::getNumLogicalCores()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:179:5: error: no declaration matches 'int hwinfo::CPU::getMaxClockSpeed_kHz()'
179 | int CPU::getMaxClockSpeed_kHz() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:179:5: note: no functions named 'int hwinfo::CPU::getMaxClockSpeed_kHz()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:189:5: error: no declaration matches 'int hwinfo::CPU::getRegularClockSpeed_kHz()'
189 | int CPU::getRegularClockSpeed_kHz() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:189:5: note: no functions named 'int hwinfo::CPU::getRegularClockSpeed_kHz()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:198:5: error: no declaration matches 'int hwinfo::CPU::getCacheSize_Bytes()'
198 | int CPU::getCacheSize_Bytes() { return -1; }
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:198:5: note: no functions named 'int hwinfo::CPU::getCacheSize_Bytes()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:14:7: note: 'class hwinfo::CPU' defined here
14 | class CPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:208:1: error: no declaration matches 'hwinfo::Socket::Socket(uint8_t)'
208 | Socket::Socket(uint8_t id) : _id(id) {
| ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:49:7: note: candidates are: 'hwinfo::Socket::Socket(const hwinfo::Socket&)'
49 | class Socket {
| ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:58:12: note: 'hwinfo::Socket::Socket(hwinfo::CPU)'
58 | explicit Socket(class CPU cpu);
| ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:49:7: note: 'class hwinfo::Socket' defined here
49 | class Socket {
| ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/cpu.cpp:216:1: error: no declaration matches 'hwinfo::Socket::Socket(uint8_t, const hwinfo::CPU&)'
216 | Socket::Socket(uint8_t id, const class CPU& cpu) : _id(id) { _cpu = cpu; }
| ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:49:7: note: candidates are: 'hwinfo::Socket::Socket(const hwinfo::Socket&)'
49 | class Socket {
| ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:58:12: note: 'hwinfo::Socket::Socket(hwinfo::CPU)'
58 | explicit Socket(class CPU cpu);
| ^~~~~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/cpu.h:49:7: note: 'class hwinfo::Socket' defined here
49 | class Socket {
| ^~~~~~
make[2]: *** [src/CMakeFiles/HWinfo.dir/apple/cpu.cpp.o] Error 1
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:17:13: error: no declaration matches 'std::string hwinfo::GPU::getVendor()'
17 | std::string GPU::getVendor() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:17:13: note: no functions named 'std::string hwinfo::GPU::getVendor()'
In file included from /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:12:
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/gpu.h:11:7: note: 'class hwinfo::GPU' defined here
11 | class GPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:23:13: error: no declaration matches 'std::string hwinfo::GPU::getName()'
23 | std::string GPU::getName() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:23:13: note: no functions named 'std::string hwinfo::GPU::getName()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/gpu.h:11:7: note: 'class hwinfo::GPU' defined here
11 | class GPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:29:13: error: no declaration matches 'std::string hwinfo::GPU::getDriverVersion()'
29 | std::string GPU::getDriverVersion() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:29:13: note: no functions named 'std::string hwinfo::GPU::getDriverVersion()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/gpu.h:11:7: note: 'class hwinfo::GPU' defined here
11 | class GPU {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:35:9: error: no declaration matches 'int64_t hwinfo::GPU::getMemory_Bytes()'
35 | int64_t GPU::getMemory_Bytes() {
| ^~~
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/src/apple/gpu.cpp:35:9: note: no functions named 'int64_t hwinfo::GPU::getMemory_Bytes()'
/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/hwinfo-852b83ba138b515ec137a9b2e23c7033bd5f4f62/include/hwinfo/gpu.h:11:7: note: 'class hwinfo::GPU' defined here
11 | class GPU {
| ^~~
make[2]: *** [src/CMakeFiles/HWinfo.dir/apple/gpu.cpp.o] Error 1
make[2]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/build'
make[1]: *** [src/CMakeFiles/HWinfo.dir/all] Error 2
make[1]: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_hwinfo/hwinfo/work/build'
make: *** [all] Error 2
Some simple getter functions, such as the ones in gpu.h
, return string attributes by const&
, such as:
HWI_NODISCARD const std::string& vendor() const;
This is an antipattern which results in potential pessimizations across the code, and it also introduces the possibility of dangerous dangling references.
Strings should be returned by value since the C++ standard guarantees copy elision since C++17, this means that any function that returns an object by value will actually construct that object at the call site, avoiding any copies and saving destructor calls.
What happens currently is that a reference (pointer address) to an internally held string is returned, if this string's value is used to initialize another string, a copy will then occur (which will result in a call to strncpy
. Moreover, since references do not implement direct ownership semantics, there is no way to know if the original owner of these strings has left the scope of the program or not, which means that if this reference is kept around, it could potentially become dangling at any time.
Hence in the current state there are two ways that these returns will be consumed:
Simply unmarking all the strings as const&
would immediately solve the problem.
The README says that almost all the MainBoard methods are implemented, but they return < unknown > for me.
Can it be the problem on my end or the methods are really not implemented properly?
Hey, I'm building a private app with hwinfo, I miss some monitoring features, before I end up building this missing parts myself I need to know if it's on the way, otherwise I will do a pull request if I get it done.... what I miss is:
Is this on the Roadmap?
I use an NVIDIA GPU, so this makes things a lot easier
As well as Current Frequency of my CPU returns the same as the base frequency while I'm getting other results in the windows task manager....
I see there is a lot of stuff already supported but not implemented, like the OpenCL library has a lot...
Is there any way to make OpenCL (quite a heavy chunk to the otherwise small and lightweight library) fully optional?
I see you have a CMake option to not use it, however git submodules still downloads the whole subtree, even if one doesn't want it.
https://cmake.org/cmake/help/latest/module/FetchContent.html comes to mind.
My code:
`hwinfo::OS os;
std::cout << "----------------------------------- OS ------------------------------------" << std::endl;
std::cout << std::left << std::setw(20) << "Operating System:";
std::cout << os.fullName() << std::endl;
std::cout << std::left << std::setw(20) << "short name:";
std::cout << os.name() << std::endl;
std::cout << std::left << std::setw(20) << "version:";
std::cout << os.version() << std::endl;
std::cout << std::left << std::setw(20) << "kernel:";
std::cout << os.kernel() << std::endl;
std::cout << std::left << std::setw(20) << "architecture:";
std::cout << (os.is32bit() ? "32 bit" : "64 bit") << std::endl;
std::cout << std::left << std::setw(20) << "endianess:";
std::cout << (os.isLittleEndian() ? "little endian" : "big endian") << std::endl;`
Thanks) Also you have the same issue in Win32 Motherboard class.
And another bug I've found that when on Windows multiple times use CoInitialize and CoUninitialize, it crashes or not retriving the next info at all (first info fine), so l've try to initialize it once and when all information I need I get then uninitialize it. Maybe it problem with my project because somewhere I already call this.
For test I create init.h and init.cpp files with init(), close() functions, then move initialization/uninitialization code there, and between them retrieve relevant information.
Originally posted by @KennyProgrammer in #38 (comment)
For the windows builds the example exits with error code and segmentation fault.
I have 2 DIMMs, and it seems hwinfo only reports half the RAM (1 DIMM).
I can see that in windows/ram.cpp, we are not iterating through the WMI results. We are only grabbing the first one.
I run into problems when using hwinfo and my GUI app which uses Qt6/Windows11.
QFileDialog::getOpenFileName and other functions did not work correctly (native was not working) after a call to the hwinfo lib.
I found that the CoInitializeEx in the wmi_wrapper caused the problem, after changing from COINIT_MULTITHREADED to COINIT_APARTMENTTHREADED all seamed to work well:
hwinfo/src/windows/utils/wmi_wrapper.cpp, line 16
_WMI::_WMI() {
auto res = CoInitializeSecurity(nullptr, -1, nullptr, nullptr, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE,
nullptr, EOAC_NONE, nullptr);
// res &= CoInitializeEx(nullptr, COINIT_MULTITHREADED); // $fixme: this is causing a crash
res &= CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
Manufacturer etc.
I think it might be beneficial to add a new job to the CI to run Example
. That way, one could see the library running, and the output it generates.
Originally posted by @facug91 in #32 (comment)
UWP apps can't use hwinfo because they are sandboxed, they can just use the winrt apis.
UWP apps might not be as common today, but there are still many around. Some people might want to intigrate this in their apps, others might want to mod these apps and a new features with hwinfo.
It is completly understandable if this might be too much work. But it would be really helpful for many people out there.
i got error when build hwinfo library after clone it on MAC:
`/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:25:10: error: out-of-line definition of 'currentClockSpeed_kHz' does not match any declaration in 'hwinfo::CPU'
int CPU::currentClockSpeed_kHz() {
^~~~~~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:31:18: error: out-of-line definition of 'getVendor' does not match any declaration in 'hwinfo::CPU'
std::string CPU::getVendor() {
^~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:47:18: error: out-of-line definition of 'getModelName' does not match any declaration in 'hwinfo::CPU'
std::string CPU::getModelName() {
^~~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:88:10: error: out-of-line definition of 'getNumPhysicalCores' does not match any declaration in 'hwinfo::CPU'
int CPU::getNumPhysicalCores() {
^~~~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:102:26: error: use of undeclared identifier 'getNumLogicalCores'
int numCores = getNumLogicalCores() / static_cast(LVL_CORES & regs_2[1]);
^
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:112:24: error: use of undeclared identifier 'getNumLogicalCores'
int numCores = getNumLogicalCores() / static_cast(1 + ((regs_3[0] >> 26) & 0x3f));
^
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:142:10: error: out-of-line definition of 'getNumLogicalCores' does not match any declaration in 'hwinfo::CPU'
int CPU::getNumLogicalCores() {
^~~~~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:179:10: error: out-of-line definition of 'getMaxClockSpeed_kHz' does not match any declaration in 'hwinfo::CPU'
int CPU::getMaxClockSpeed_kHz() {
^~~~~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:189:10: error: out-of-line definition of 'getRegularClockSpeed_kHz' does not match any declaration in 'hwinfo::CPU'
int CPU::getRegularClockSpeed_kHz() {
^~~~~~~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:198:10: error: out-of-line definition of 'getCacheSize_Bytes' does not match any declaration in 'hwinfo::CPU'
int CPU::getCacheSize_Bytes() { return -1; }
^~~~~~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:208:9: error: out-of-line definition of 'Socket' does not match any declaration in 'hwinfo::Socket'
Socket::Socket(uint8_t id) : _id(id) {
^~~~
/Users/syukur/Downloads/mac-project/third_party/hwinfo/src/apple/cpu.cpp:216:9: error: out-of-line definition of 'Socket' does not match any declaration in 'hwinfo::Socket'
Socket::Socket(uint8_t id, const class CPU& cpu) : _id(id) { _cpu = cpu; }`
Against my first intuition, this library should probably be available with a version using C++03 or at least C++11 standard for usage with older compilers
Therfore, We need to figure out the parts of the library that depend on newer standards.
Actions fail for Cygwin and MSYS2. This might just be an issue with the workflow files...
in arm64 debian9 , gcc 6.3.0,compile error
#include cpu.h:7:20: fatal error: optional: No such file or directory
In GPU class in one of Win32 getVendor, getName, getDriverVersion, you try retrive 0 element from vector, and then you check if ret is string is empty, but if vector is empty and you try to retrive 0 element is crashed.
How it was:
std::string GPU::getVendor() {
std::vector<const wchar_t*> vendor{};
wmi::queryWMI("WIN32_VideoController", "AdapterCompatibility", vendor);
auto ret = vendor[0];
if (!ret) {
return "<unknown>";
}
std::wstring tmp(ret);
return {tmp.begin(), tmp.end()};
}
How it should be :
std::string GPU::getVendor() {
std::vector<const wchar_t*> vendor{};
wmi::queryWMI("WIN32_VideoController", "AdapterCompatibility", vendor);
if(vendor.empty())
return "<unknown>";
auto ret = vendor[0];
std::wstring tmp(ret);
return {tmp.begin(), tmp.end()};
}
Please fix this with all this functions, even if library cannot retrive some hardware properties it at least should return unknown but not a crash.
__get_cpuid_count(func_id, sub_func_id, ®s[0], ®s[1], ®s[2], ®s[3]);
__get_cpuid_count function undefine
jetson arm unbuntu linux
What a wonderful project, exactly what I needed. Many thanks.
However I'm not succeeding in making the example programs. I do:
mkdir build
cmake -B build -DCMAKE_BUILD_TYPE=Release # -DNO_OCL=ON
cmake --build build
cmake --install build
cd examples
mkdir build
cmake -B build -DCMAKE_BUILD_TYPE=Release # -DNO_OCL=ON
cmake --build build
and get
hwinfo/examples/system_infoMain.cpp:5:10: fatal error: hwinfo/hwinfo.h: No such file or directory
5 | #include <hwinfo/hwinfo.h>
I see it only installs /usr/local/include/fmt/*
, not hwinfo.h
Is there something I'm missing here?
(I'm new to cmake and am inventing the runes. Maybe document them, and --install, for us newbies?)
Blessings
M
Running these instructions created a Debug build
git clone https://github.com/lfreist/hwinfo && cd hwinfo
mkdir build
cmake -B build && cmake --build build
cmake --install build
However, the install command is looking for it in Release
CMake Error at build/src/cmake_install.cmake:51 (file):
file INSTALL cannot find
".../hwinfo/build/lib/Release/hwinfo_battery.lib":
No error.
Call Stack (most recent call first):
Apparently the code currently covers only Intel platforms. Possible to add support for POWER (for *BSD and AIX) and PowerPC (for Apple)?
I'm hitting crashes/exceptions due to what seems to be incorrect handling of IEnumWbemClassObject::Next
ULONG u_return = 0;
IWbemClassObject* obj = nullptr;
int cpu_id = 0;
while (wmi.enumerator) {
wmi.enumerator->Next(WBEM_INFINITE, 1, &obj, &u_return);
if (!u_return) {
break;
}
...
That pattern above seems to be used in several places, and I believe it has a few bugs
u_return
can have 1
set from the previous loop iteration and not that last Next
callobj
can be set from the previous loop iteration, instead of the current Next
call, causing Object is not connected to server
error when trying to use it (since that was already release)I can't reproduce the issue on my machine, but several other developers are encountering this problem.
To be fair, I didn't read the entire documentation for Next (https://learn.microsoft.com/en-us/windows/win32/api/wbemcli/nf-wbemcli-ienumwbemclassobject-next) , but the easiest fix seems to be to simply move u_return
and obj
to inside the loop to avoid side effects from the previous iteration, and thus we can rely on that for the checks. E.g:
int cpu_id = 0;
while (wmi.enumerator) {
ULONG u_return = 0;
IWbemClassObject* obj = nullptr;
wmi.enumerator->Next(WBEM_INFINITE, 1, &obj, &u_return);
if (!u_return) {
break;
}
...
Hello,
First of all thanks a lot for this wonderful library. I was looking for something similar and I was so happy to find out hwinfo meets exactly my need. I'm currently going to use it https://github.com/julianxhokaxhiu/FFNx and it will help the troubleshooting drastically through the ability to expose the current user specs in the log.
Unfortunately although because I use a rendering library named bgfx, I have no ability to match which GPU is currently being used, since the library allows me to know only the GPU vendor id
and device id
.
Would it be possible for you to expose this info as well in the GPU interface so I can use it to compare? Having it as an int
type would be perfect.
Thanks a lot and best regards,
Julian
@lfreist libfmt
is used by many ports, and it is undesirable to build numerous duplicates of it. It also wastes compilation time.
Could we add a configure arg to use a pre-installed libfmt
?
I would suggest removing GPU information from the library entirely. If people need information about the GPU, getting it from Vulkan, DirectX, OpenGL, or OpenCL is already really well documented. Those standards [and similar] are really the only places people would need it anyhow.
I would suggest removing GPU information from the library entirely. If people need information about the GPU, getting it from Vulkan, DirectX, OpenGL, or OpenCL is already really well documented. Those standards [and similar] are really the only places people would need it anyhow.
I'm not trying to be rude, but there really is zero reason to include it. For people who are already using one of these frameworks, adding OpenCL on top of it is unacceptable in most cases especially considering OpenCL is on its way out the door to be replaced with other alternative frameworks.
Edit: Had a quick think. It'd probably be better to make the entire library modular. You already have the library well divided as appropriate, making it modular seems like a very safe next step. In other words, I mean making the motherboard, battery, CPU, etc. dependent on user choice.
original post by @F35H in #54 (comment)
HWinfo aims to provide a uniform API for Linux, Windows and OSX.
Since I do not have a device running OSX, it's development sluggish.
Bringing back OSX support is a great first task for passionated OSX developers of any levels of experience:
It teaches you the internal structure of HWinfo and enables you to contribute further improvements/ideas to its functionality later.
Querying information of the hardware/system is heavily OS specific. In Order to provide a uniform API for different OSs, HWinfo is structured as follows:
src
directory (src/windows
, src/apple
, src/linux
). These folders contain the OS specific implementationssrc
to reduce redundancyMy recommended approach is the following:
"unknown"
for functions returning std::string
and -1
for functions returning int
.Thank you for contributing!
I found a bug using the GPU module.
When compiled as user PCIMapper looks for the id files at /home/${user}/.hwinfo/pci.ids
However if the program is ran as sudo or root the getenv("HOME"); function will return /root/.hwinfo/pci.ids
I propose this line be changed to store the pci.ids file to the same location as the applications binary.
https://github.com/lfreist/hwinfo/blob/b4adfd795aa2aa25b8dff6dd8116725f72b187dd/CMakeLists.txt#L39C67-L39C67
I'm trying to get into some open-source coding so if you would let me know your opinions I would be happy to implement them.
For Linux, only memory size, available and free memory is available.
TODO:
Add information for each memory module (DIMM) similar to windows.
Line to start with
I would like to be able to use the standard find_package(hwconfig REQUIRED)
in CMakeLists.txt. Could you provide it? This could also solve the problem of having to install hwinfo inside the project directory for each project.
Hey, thanks for this awesome framework, I'm building a private simple monitoring software to monitor my PC on the tablet.
I'm going to choose Unreal Engine for the UI design ...
Unreal Engine only supports .dll for windows, .dylib for mac and .so for linux, I'm literary lost how to generate the build folder to these formats, mainly for windows and linux....
Please add support for Dynamic Libraries in the CMake File and mention it in the Project Readme.
Thanks a lot I hope I get a reply back soon, best wishes....
D:/mini_tool/third_party/hwinfo/include/hwinfo/WMIwrapper.h:91:23: error: cast from 'BSTR {aka wchar_t*}' to 'int' loses precision [-fpermissive]
value.push_back((T)((bstr_t)vtProp.bstrVal).copy());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make32[2]: *** [third_party\hwinfo\src\CMakeFiles\HWinfo.dir\build.make:406: third_party/hwinfo/src/CMakeFiles/HWinfo.dir/windows/cpu.cpp.obj] Error 1
make32[1]: *** [CMakeFiles\Makefile2:140: third_party/hwinfo/src/CMakeFiles/HWinfo.dir/all] Error 2
make32: *** [Makefile:90: all] Error 2
Using #if defined(__linux__)
... within all method implementations becomes unreadable...
Alternative structure:
For each header file, I create
Hello, in your code, I found two places that easily lead to memory leaks; 1. I noticed that the memory space and resources of wmi.enumerator were not released before each query was run. This can result in a new WMI enumerator object being created each time the query is run, without the old object being freed, resulting in a memory leak. 2. When calling the hr = obj->Get(L" ", 0, &vt_prop, nullptr, nullptr) function multiple times, a new vt_prop object will be created each time it is run. You only use VariantClear(&vt_prop) the last time ;In fact, this will only release one of the vt_prop objects. The correct approach should be to call obj->Get() every time, followed by VariantClear().
Segmentation fault probably at this line.
I cannot reproduce the issue local - even when running with address sanitizer everything runs just fine.
Would be happy, if someone can reproduce and provide more details...
Hello @lfreist
I have built successfully hwinfo on Windows 10 using Msys2 using next commands:
git clone https://github.com/lfreist/hwinfo
cd hwinfo
mkdir build
cd build
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
make
However running Example.exe no hardware info is displayed. See next picture:
I saw there is a version for Visual Studio however I am working with open source tools.
Can you help me to fix this issue?
Is it possible to use hwinfo with Msys2 environment?
I'm on a Gigabyte A5 K1 right now running Windows 11. It doesn't look like hwinfo reports the touchpad, but I was able to pull it up from the System Information.
It would be particularly helpful if hwinfo could report screwed up drivers. Somehow there was some sort of reset to my drivers which screwed them up. I had to uninstall the touchpad driver - using the Device Manager - and restart to fix it.
Full GPU information is only available for Windows yet...
Line 123 in 8b1ea12
displays 100 when 8 would be correct
Just wrap it into a function
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.