![](/img/trans.png)
[英]How do I strip out inactive #if directives with the gcc/g++ preprocessor?
[英]How do I turn off the gcc preprocessor on linux?
我已經google了一段時間turning off the gcc preprocessor on linux
(使用那個確切的短語),一切都無關緊要。 例如,我想關閉除預處理器之外的所有內容(與我想要的相反)或加壓警告。 有誰知道禁用預處理器的方法? 我發現Facebook開發和聲稱的更快,我想測試一下。
將文件命名為program.i
而不是program.c
,它將被視為已經由GCC / Clang預處理並直接發送給編譯器。
例:
$ cat t.i int printf(const char *f, ...); int main(){ printf("hello world\n"); } $ gcc t.i && ./a.out hello world
我測試了lornix在評論中所說的內容,它有效:
將其他/更新的預處理器命名為“cpp”並將其放入路徑中,並將原始cpp重命名為cpp-other或cpp-orig。 考慮到你試圖替換cpp,它會很好用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.