C++ Eclipse 表示参数无效(类型不正确)

Bob*_*Bob 5 c++ eclipse warnings

代码是

g_CDioService->getDioPrjMgr()->NotifyBtMacAddress(std::string(path));
Run Code Online (Sandbox Code Playgroud)

声明是

void NotifyBtMacAddress(const std::string &path);
Run Code Online (Sandbox Code Playgroud)

Eclipse 下划线NotifyBtMacAddress并说

Invalid arguments 'Candidates are: void NotifyBtMacAddress(const ? &)'
Run Code Online (Sandbox Code Playgroud)

我什至试图将它显式转换为实际预期的类型:

g_CDioService->getDioPrjMgr()->NotifyBtMacAddress(const_cast<const std::string & >(std::string(path)));
Run Code Online (Sandbox Code Playgroud)

但仍然给出相同的(红色下划线)错误/警告。

我可以访问函数的源代码

void CDioPrjMgr::NotifyBtMacAddress(const std::string &path){

   // PASLOG(ZONE_FUNC, __FUNCTION__, "Sequence: PRJ_DIO -> PRJ_Manager : Send BT MAC ADdress");

    // On recving Disable BT command, Send Mac Addres to Mgr.
...
Run Code Online (Sandbox Code Playgroud)

gsa*_*ras 6

IDE 通常无法解决某些问题(出于各种原因),但这并不总是意味着代码是错误的

因此,只需保存项目或/并构建它。


另一个有时有效的技巧是:Project->Index->​​Rebuild 强制 Eclipse 再次仔细查看所有内容 - 学分:user4581301


由于这里没有最小的示例,我们无法重现您所看到的内容。

  • @Adrian 另一个有时有效的技巧是 Project-&gt;Index-&gt;​​Rebuild 以强制 Eclipse 再次仔细查看所有内容。 (2认同)