C++ Primer 书店程序在VsCode中 error: no match for call to ‘(std::__cxx11::string...)错误

原来的文件中代码中total.isbn()==trans.isbn()在VsCode中会报错,“无法匹配调用错误”。
compile.cpp:12:37: error: no match for call to ‘(std::__cxx11::string
{aka std::__cxx11::basic_string}) ()’
if (total.isbn()==trans.isbn())
解决办法:将.isbn()后的括号去掉,原语句改为

if (total.isbn==trans.isbn)

便可运行,原因是isbn应该是参数值,而非方法,也可能是本人的环境导致,仅供参考。

#include 

#

你可能感兴趣的:(学习杂记,c++,vscode)