簡體   English   中英

如何從CodeBlocks或Makefile強制包含標頭?

[英]How to force a header inclusion from CodeBlocks or from a Makefile?

我有這個文件:

// File.cpp

int main() {
   FuncToChange(4, 6, 9, 12);
}

現在,我需要獲得以下行為:

// Config.h

#define FuncToChange($1, $2, $3, $4) NewFunc($1, $3, $4)

// File.cpp

#include "Config.h"

int main() {
   FuncToChange(4, 6, 9, 12);
}

如何在不修改原始“ File.cpp”文件的情況下(即沒有明確地#include“ Config.h”)進行操作?

是否可以從makefile或IDE(在這種情況下為CodeBlocks)強制包含標頭?

謝謝!

平台:
代碼塊10.05
海灣合作委員會/ MinGW
Windows 7的

預處理器選項頁面上的GCC頁面:

-include file
    Process file as if #include "file" appeared as the first line of the
    primary source file. However, the first directory searched for file is
    the preprocessor's working directory instead of the directory containing
    the main source file. If not found there, it is searched for in the remainder
    of the #include "..." search chain as normal. If multiple -include options
    are given, the files are included in the order they appear on the command line.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM