How do I turn off the gcc preprocessor on linux?

孤人 提交于 2019-12-01 22:43:24

I tested what lornix said in a comment, and it works:

Name the other/newer preprocessor "cpp" and put it in your path, and rename the original cpp to cpp-other or cpp-orig. It'll work great considering you are attempting to replace cpp anyways.

Name your file program.i instead of program.c and it will be treated as already pre-processed by GCC/Clang and sent directly to the compiler.

Example:

$ cat t.i
int printf(const char *f, ...);

int main(){
  printf("hello world\n");
}
$ gcc t.i && ./a.out 
hello world
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!