c - GetPhysicallyInstalledMemory 函数 - C 中 undefined reference

标签 c windows winapi

我想获取计算机的物理安装 RAM 以及其他系统信息。 当我尝试编译代码时,它会给出错误“对 GetPhysicallyInstalledSystemMemory 的 undefined reference ”以及一条警告,指出这是一个隐式声明。

我正在使用 Code::Blocks 17.12 和最新的 GCC。

#define WINVER 0x0A00
#define _WIN32_WINNT 0x0A00
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

int main()
{

    long ram;
    BOOL Checkram;

    Checkram = GetPhysicallyInstalledSystemMemory(&ram);
    printf("Installed RAM is: %lu", ram);

    return 0;
}

我对 C 编程非常陌生,我确实阅读了 Microsoft 文档,但它仍然没有帮助我解决这个问题。

更新: 我已经用 Visual Studio 编译了它,现在它可以工作了。

最佳答案

我已切换到 Visual Studio,它解决了问题。

关于c - GetPhysicallyInstalledMemory 函数 - C 中 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57006954/

相关文章:

c - 如何在 Visual C 中对视频进行编码?

c++ - 调用 MapViewOfFile 时出错

c++ - 如何向创建对象的类发送消息

c - 打开二进制文件并使用 malloc 创建数组的程序

c - 删除 list.h 列表的第一个元素

python - 带参数的 Windows 子进程

c# - 服务错误 1053 : Could not start in timely fashion

c - 为什么仅在将变量传递给 '-lm' 函数时才显式使用 'math.h'?

c - c89 标准要求实现提供哪些硬件特定定义?

windows - 颠覆 : How do you avoid forgetting to check stuff in?