error: there are no arguments to ‘xxxx’ that depend on a template parameter, so a declaration of ‘xx

背景:在写C++代码时,模板类的成员函数里面调了一个其他文件中的普通函数(没有使用模板),结果出现错误:

error: there are no arguments to ‘xxxx’ that depend on a template parameter, so a declaration of ‘xxxx’ must be available [-fpermissive]

大概就是一个模板函数中,调用了一个不在当前文件的函数,导致编译器无法确定这个函数到底是哪来的,可以当前文件中使用一个普通函数来桥接一下外部函数,然后供模板类中的成员函数使用。

猜你喜欢

转载自blog.csdn.net/dddgggd/article/details/129094293
今日推荐