2011-02-17 31 views
0

以前從未遇到過的奇怪之處。我寫了這個功能我校的一個項目:函數參數是「#define」?

void j_glOrtho(int left, int right, int bottom, int top, float near, float far) 

出於某種原因,微軟的Visual C++說,nearfar#define而不是float。因此,當我嘗試將它們用作float時,出現編譯器錯誤。任何人都知道發生了什麼事?

+1

當這種情況發生時,我多次撞擊我的鍵盤。 – Marlon 2011-02-17 03:14:44

+0

@Marlon:這讓我擔心 - 小心鍵盤不會中斷。 – Mehrdad 2011-02-17 03:17:06

回答

3

我相信這是DOS和16位事物的一些傳統兼容性。我不知道這是否可行,但試試吧:

#ifdef near 
#undef near 
#endif 
#ifdef far 
#undef far 
#endif