A function-definition is not allowed here before '{'

人走茶凉 提交于 2019-11-29 11:28:47
  image_buffer_ = NULL; // just set it to null if it doesn't :\
}

Placing a backslash at the end of a line splices it with the line that follows, which, effectively, comments out the closing bracket in your function.

Watch this line:

  image_buffer_ = NULL; // just set it to null if it doesn't :\

This begins a multi-line comment, commenting out the following:

}

Your compiler should warn you about this.

Remove the \ and then you can move on to the rest of your warnings and errors!

    image_buffer_ = NULL; // just set it to null if it doesn't :\
}

Here's a hint: what do you think the escape character \ does to the newline at the end of that line?

Yes, that's right, it escapes it, effectively bringing the closing brace on the next line into the comment.

Hence, you're missing a closing brace.

Maybe you should keep your emotions out of the code :-)

If you use an auto-indenting code editor (and if you don't, why not?), it would immediately show you where the unbalanced braces are. (Assuming, of course, that it's smart enough to recognize the // ...\ as a multi-line comment :-)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!