首页 > 代码库 > 解决:std::ostream operator<< should have been declared inside 'xxx'

解决:std::ostream operator<< should have been declared inside 'xxx'

用VS的NMAKE构建,不会报错,但是用GNU MAKE构建,就会报错。(尝试删除Toast.h中第24行的声明)

因此在遇到类似的情况的时候,记得不仅class里面要有friend声明,namespace里面也要有声明

点此下载demo

解决:std::ostream operator<< should have been declared inside 'xxx'