解决方案:error: ‘cout’ does not name a type

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/github_39611196/article/details/83046404

在ubuntu中编译cpp文件时,出现了如下错误:

/home/exbot/tutorial_ws/src/time_d/src/timetest.cpp:26:1: error: ‘cout’ does not name a type
 cout<< "d2" <<d2 <<endl;
 ^

解决方案:将cout语句放入函数体内,就不会出现如上错误了。

猜你喜欢

转载自blog.csdn.net/github_39611196/article/details/83046404