我想爲應用程序ID使用某種常量(所以我可以在printf中使用它)。在printf中使用#define?
我有這樣的:
#define _APPID_ "Hello World!"
然後是簡單的printf,並稱其爲%S(串)。這又打消了這個:
simple.cpp:32: error: cannot convert ‘_IO_FILE*’ to ‘const char*’ for argument ‘1’ to ‘int printf(const char*, ...)’
我會用定義在printf中使用應用程序ID?我試過:
static const char _APPID_[] = "Hello World"`
但它沒有工作,我認爲同樣的錯誤。
請您發佈實際的printf()行嗎?同時指出你正在使用的編譯器。 – 2010-06-10 02:22:41
同樣的錯誤*「你認爲」*?它要麼是或者不是。你編譯的代碼,而不是我們。如果你不知道你得到了什麼錯誤,你期望別人怎麼樣? – jalf 2010-06-10 02:30:23
'#define'和'printf()'?你確定這是一個C++的問題嗎? – MSalters 2010-06-10 08:47:40