全部, 这里需要一些帮助。我来自纯Java背景,对C编程了解不多。基本上我需要编写一个 C 程序(并创建一个可执行文件)来输出 Windows 机器 (XP/2008/7) 上的可用字节数 (RAM)
我对此做了一些研究,发现有一个名为 GlobalMemoryStatusEx 的函数,还有一个链接: http://msdn.microsoft.com/en-us/library/aa366589(v=vs.85).aspx
我已经用 gcc 安装了 cygwin,但上面的程序甚至不能为我编译。我知道我在这里做了一些愚蠢的事情..
$ gcc hello.c -o hello.exe
hello.c:3:19: error: tchar.h: No such file or directory
hello.c: In function `main':
hello.c:7: error: `MEMORYSTATUSEX' undeclared (first use in this function)
hello.c:7: error: (Each undeclared identifier is reported only once
hello.c:7: error: for each function it appears in.)
hello.c:7: error: expected `;' before `statex'
hello.c:9: error: `statex' undeclared (first use in this function)
非常感谢任何帮助!
最佳答案
正如 larsmans 所说,cygwin 不是 Windows native 编译器。除了 MinGW,您还可以考虑 Visual C++ 2010 Express .
关于c - 以编程方式在 Windows 中获取可用 RAM?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5031791/