1

I'm trying to compile an Apache HTTP server module. One of the steps involves compiling from source. The problem is that I'm getting

wsgi_memory.obj : error LNK2019: unresolved external symbol GetProcessMemoryInfo 
referenced in function get PeakRSS

Then I checked the source for wsgi_memory to check if it was missing some libraries, it currently has the following

#include <windows.h>
#include <stdio.h>
#include <Psapi.h>
#pragma comment(linker, “Psapi.lib”) 

I currently have Windows SDK 7.1, should I update something?

Julio Cáceres
  • 141
  • 2
  • 7
  • Did you see the bit of the docs that says it's in different files, depending on OS version? – enhzflep Oct 05 '16 at 19:37
  • 1
    @enhzflep: probably not relevant, because the OP is explicitly incorporating `psapi.lib` and `kernel32.lib` is always included. The fact that the name has changed to `K32GetProcessMemoryInfo` (unless you explicitly define `PSAPI_VERSION` to 1) is probably more to the point. – Harry Johnston Oct 05 '16 at 22:14
  • @HarryJohnston - Cheers, thanks for that. Interesting to hear that VS works like that. I only ever link kernel32 if I know I need something inside it (I only use VS for the _stellar_ debugger) – enhzflep Oct 05 '16 at 22:25
  • 1
    @enhzflep: it's one of the handful of frequently-used libraries included in the default settings. Including an unused library has no overhead (except at build time, and even that's negligible) so there's no particular reason to be choosy. But you do have a point - the OP might not be using the default settings, in which case kernel32.lib might not be present. – Harry Johnston Oct 05 '16 at 22:29
  • 2
    The pragma is quite wrong, it is #pragma comment(lib, “Psapi.lib”). The posted version produces lots of noise, both from the compiler because of the wrong double-quotes and from the linker because of the wrong directive. Only way you can't hear that is if the pragma is bypassed completely by the pre-processor. – Hans Passant Oct 06 '16 at 12:06

0 Answers0