需要将#include <windows.h>放到using namespace System;前面。
#include <windows.h>using namespace System;
参考:
https://bytes.com/topic/net/answers/668107-managed-lib-into-unmanaged-project