初級 › error: expected ',' or ';' before ... の原因と直し方 › パターン1
error: expected ',' or ';' before ... の原因と直し方
文末のセミコロンを書き忘れたときに出るエラーです。
1 #include <iostream> 2 int main() { 3 int x = 5_ ^ 4 std::cout << x << std::endl; 5 return 0; 6 }
main.cpp:4:5: error: expected ',' or ';' before 'std'
空欄を埋めてコンパイル・実行を通す
文の終わりにはセミコロンが必要です。エラーは次に見つかった手がかり(ここではstd)の位置を指すため、実際に直す場所は1行上です。
次の問題