[問題] g++出現error gcc卻可以
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
GCC
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
void funA()
{
printf("A\n");
}
void funB(int x)
{
printf("B\n");
}
int main()
{
void (*QQQ) ();
QQQ = &funB; // invalid conversion from 'void (*)(int)' to 'void (*)()
QQQ();
return 0;
}
補充說明(Supplement):
為什麼用gcc 可以成功
而g++ 卻有error
不是因該都有error嗎?
不是應該要寫成下面這樣嗎?
void (*QQQ) (int)
QQQ = &funB;
QQQ(123);
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.110.133.100
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1429593743.A.D9C.html
→
04/21 13:44, , 1F
04/21 13:44, 1F
→
04/21 15:10, , 2F
04/21 15:10, 2F
→
04/21 15:10, , 3F
04/21 15:10, 3F
→
04/21 20:36, , 4F
04/21 20:36, 4F
推
04/23 01:24, , 5F
04/23 01:24, 5F
→
04/23 01:24, , 6F
04/23 01:24, 6F