在:http://www.learncpp.com/cpp-tutorial/110-a-first-look-at-the-preprocessor/C++ - 我怎樣才能避免這個標題出現兩次?
在部首警衛,還有那些代碼片斷:
add.h:
#include "mymath.h"
int add(int x, int y);
subtract.h:
#include "mymath.h"
int subtract(int x, int y);
main.cpp中:
#include "add.h"
#include "subtract.h"
如何避免#include "mymath.h"
在main.cpp
中出現兩次?
感謝。
爲什麼你想避免它包括兩次? – sth 2011-01-22 17:24:54