我有一段代码从 codeProject 下载。
#if
预处理器指令似乎不像我期望的那样工作。
在下面的代码中,当项目构建时显示错误消息 DShowNET could not be found。由于 DSHOWNET 从未被定义,我很惊讶 'using DShowNET' 甚至被处理了。
我没有在 MyProject >> Properties >> Build Tab >> Conditional compilation symbols 中定义 DSHOWNET(对话框为空)。
using System;
using System.Collections;
using System.Runtime.InteropServices;
#if DSHOWNET
using DShowNET;
using DShowNET.Device;
#else
#if VS2003
#else
using System.Runtime.InteropServices.ComTypes;
#endif
using DirectShowLib;
#endif
#if 预处理指令在 Visual Studio Express 版本中是否有效?DSHOWNET 是否需要显式“未定义”?还是我遗漏了其他基本概念?
#if DSHOWNET
语句内的代码 - 它是否呈灰色状态或保留了原有的语法高亮? - slugster