Can't use cout/endl when extern "C"
There is something wrong with your compilation environment. There is nothing wrong with that code. It compiles and runs fine.
In a comment to the question you say:
I'm learning to write a driver so I can do stuff with my devices like keyboards and mouses, so I'm using the WDK. Correct me if I'm wrong, but I thought you need to use extern "C" to use those header files?
In fact you should simply write code in C rather than C++ for driver development.