<分区>
是否有一个实用程序可以删除 #ifdef PRO_VERSION ... #endif
代码?
请不要告诉我有关 Visual Studio 编译器标志或 XCode 的 View 后处理源的信息。我无法像控制台应用程序那样方便地自动化它。
我在这里要做的是找到一个现有的实用程序(如果存在)。如果不是……我想我将不得不重新发明轮子。
<分区>
是否有一个实用程序可以删除 #ifdef PRO_VERSION ... #endif
代码?
请不要告诉我有关 Visual Studio 编译器标志或 XCode 的 View 后处理源的信息。我无法像控制台应用程序那样方便地自动化它。
我在这里要做的是找到一个现有的实用程序(如果存在)。如果不是……我想我将不得不重新发明轮子。
最佳答案
unifdef可能正是您要找的。p>
来自 its manual :
The unifdef utility acts on #if, #ifdef, #ifndef, #elif, #else, and #endif lines. A directive is only processed if the symbols specified on the command line are sufficient to allow unifdef to get a definite value for its control expression. If the result is false, the directive and the following lines under its control are removed. If the result is true, only the directive is removed. An #ifdef or #ifndef directive is passed through unchanged if its controlling symbol is not specified on the command line. Any #if or #elif control expression that has an unknown value or that unifdef cannot parse is passed through unchanged.
关于c++ - 是否有#ifdef 剥离 C/C++ 实用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15893710/