How do I turn off the gcc preprocessor on linux?

早过忘川 提交于 2019-12-02 00:08:29

问题


I have googled turning off the gcc preprocessor on linux for a good while now (using that exact phrase) and everything has been irrelevant. For example I want to turn off everything except the preprocessor (the opposite of what I want) or pressurising warnings. Does anyone know of a way to disable the preprocessor? I found one that Facebook developed and claimed is faster, and I would like to test it out.


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/24561769/how-do-i-turn-off-the-gcc-preprocessor-on-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!