关于c/c++的#error, 自己用得不多, 一般在编译的时候才会用, 写个代码demo来看看:
复制代码
出现预期中的编译错误:
1
2
3
4
5
6
7
8
9
10
11
12
13#define xyz "just for test" #ifdef xyz #error "wrong" #endif #include <iostream> using namespace std; int main() { cout << "main" << endl; return 0; }
C:Documents and SettingsAdministrator桌面cpptestmain.cpp(3) : fatal error C1189: #error : "wrong"
#error有时还挺有用的, 主要是提醒程序猿, 其实是强迫程序猿来修改对应的问题。
最后
以上就是飞快舞蹈最近收集整理的关于C/C++的#error的全部内容,更多相关C/C++内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复