I don’t think this is a proper approach.
You should pass appropriate (Windows specific) flags to the compiler. I guess @bellenot can help with this.
An example (note that the “debug” and C++ standard flags must correspond to your ROOT binary distribution):