源文件代码如下:
1 #include "stdafx.h"
2 using namespace std;
3 #include <iostream>
4 #define T 1
5 #define ABC void main() \
6 {cout<<"hello!"<<s <<endl;}
7 #include "abc.h"
8
2 using namespace std;
3 #include <iostream>
4 #define T 1
5 #define ABC void main() \
6 {cout<<"hello!"<<s <<endl;}
7 #include "abc.h"
8
头文件代码如下:abc.h
1 #if T
2 char s[] = "good morning!";
3 ABC
4 #endif
2 char s[] = "good morning!";
3 ABC
4 #endif
替换后代码如下:
1 #include "stdafx.h"
2 using namespace std;
3 #include <iostream>
4 char s[] = "good morning!";
5 void main()
6 {
7 cout<<"hello!"<<s <<endl;
8 }
2 using namespace std;
3 #include <iostream>
4 char s[] = "good morning!";
5 void main()
6 {
7 cout<<"hello!"<<s <<endl;
8 }
执行后哦输出如下:
hello! good morning!