So I’ve been working on a small app that at some runs runs an application as another user, I’m writing it in C and using the MinGW GCC compiler to compile and link it. My issue is that whenever I try to use the WINAPI function CreateProcessWithLogonW() I get an error that says “Undefined reference to CreateProcessWithLogonW().”
This is in spite of the fact that I link the Advapi32 when I compile it like so,
gcc file.c -lAdvApi32 -o filename
The correct solution is to actually #include the correct mingw32 headers: i.e.
Though the solution that Anthales proposed works, it doesn’t scale well.