c++编译报错:xxx was not declared in this scope

根本原因:变量、函数、或者类未声明或者定义。
实际原因:被调用的代码,写在调用处的下面了,比如:

void funcA(){
	funcB();
	// do something
}

void funcB(){
	// do something
}

这就会报错:funcB was not declared in this scope.

挪一下位置就好了:

void funcB(){
	// do something
}

void funcA(){
	funcB();
	// do something
}

编译通过。

版权声明:本文为博主作者:王老桔原创文章,版权归属原作者,如果侵权,请联系我们删除!

原文链接:https://blog.csdn.net/w_y_x_y/article/details/135742861

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
心中带点小风骚的头像心中带点小风骚普通用户
上一篇 2024年4月22日
下一篇 2024年4月22日

相关推荐