使用#if __has_include(<xxxx.h>) 例如 #if __has_include(<linux/dma-buf.h>) MODULE_IMPORT_NS(DMA_BUF); #endif