在示例代碼中的多餘的分號,你向我們展示:
if(...)
{
...
};
是完全合法的;這是一個空聲明。
您遇到的錯誤實際上是關於extern "C"
上的額外分號。在三個源文件中出現以下的zziplib
庫:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
};
#endif
這其實是一個語法錯誤。一些編譯器可能不會抱怨它,或者可能只發出警告,但是這是一個致命的錯誤。
我報道這個問題的zziplib
維護者,而我剛剛得到的答覆:
Thanks for pointing to the problem, fixed in r524 now. I will
probably roll a public release next month (still need to check
the win32 version).
best regards, Guido Draheim
ChangeLog:
2012-09-15 guidod <[email protected]>
* zzip.h, plugin.h: "};" at end of extern-C produces build errors with
the default --pedantic-errors on newer CMake. Thanks to Keith Thompson
recognizing it - see http://stackoverflow.com/questions/12384280/
分號的'if'語句的結束'}'應該是完全合法的下面。在這種情況下,它只是一個空聲明。你提到標題,所以我懷疑你在聲明後實際上有一個流浪分號。請向我們展示一個實際的代碼片段。你能告訴我們你使用的開源頭文件嗎?你能修好頭部嗎? –
@KeithThompson,添加了一個鏈接到真實文件。 –