Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何停止C中的预编译?_C_Precompiled_Conditional Compilation - Fatal编程技术网

如何停止C中的预编译?

如何停止C中的预编译?,c,precompiled,conditional-compilation,C,Precompiled,Conditional Compilation,查看config.h中的代码: #if (API_TYPE == 1) #define URL_API @"https://dapi.xxx.com/1.1/" #elif (API_TYPE == 2) #define URL_API @"https://tapi.xxx.com/1.1/" #elif (API_TYPE == 3) #define URL_API @"https://api.xxx.com/1.1/" #else // I want stop

查看config.h中的代码:

#if (API_TYPE == 1)
    #define URL_API @"https://dapi.xxx.com/1.1/"
#elif (API_TYPE == 2)
    #define URL_API @"https://tapi.xxx.com/1.1/"
#elif (API_TYPE == 3)
    #define URL_API @"https://api.xxx.com/1.1/"
#else
   // I want stop pre-compile if in here.
   // assert(0);
#endif
API_类型只能定义为1,2,3。如果定义为其他值,则是错误的。 我可以在#else路径中编写一些非法代码。但它并不完美。如果预编译过程转到#else路径,是否有任何命令或方法停止预编译过程?

您可以插入
#error“error message”
,这将停止预处理,编译甚至不会开始。

使用#error