1.error:passing ‘const EyeseeLinux::MediaFile‘ as ‘this‘ argument discards qualifiers [-fpermiss
class MediaFile
{
public:
void RenameFileByLabel(std::string label);
……
private:
……
};
const MediaFile& mf;
……
//mf.RenameFileByLabel(label) 会报错!!!
(*((MediaFile*)&mf)).RenameFileByLabel(label);//直接类型强转再调用
2.error:incomplete type ‘ XXX’ used in nested name specifier:
解决办法:在A.h 文件中,不仅需要包含B类#include"B.h",同时要在class A 前面加一行 class B; B类也需要同样的操作。