error:语句无法解析重载函数C ++的地址

时间:2017-06-18 02:55:30

标签: c++

我正在通过书学习C ++,并试图测试循环游戏战斗的简单编码。一个while循环内的开关。

damage = greatsword[0] + player[1] - enemy[2]; endl;
  

错误:语句无法解析重载函数的地址|

我在4个不同的代码行中出现此错误,并且在每个代码行中都有“损坏”#39;所以我认为它有些问题。我将损坏声明为int并在尝试将其更改为攻击值之前设置为0。如果需要,我可以提供更多代码。我也尝试将名称从x更改为dmg以查看是否是问题

2 个答案:

答案 0 :(得分:0)

你有一个尾随cout << ... << endl;,你可能并不想包含它。 std::endl是在打印到输出流时使用的函数;通常你会看到C:\Users\thathine>sbt Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; sup port was removed in 8.0 [info] Loading project definition from C:\Users\thathine\project [info] Updating {file:/C:/Users/thathine/project/}thathine-build... [info] Resolving org.scala-lang#scala-library;2.11.8 ... [error] Server access Error: Received fatal alert: access_denied url=https://rep o.typesafe.com/typesafe/ivy-releases/org.scala-lang/scala-library/2.11.8/ivys/iv y.xml [error] Server access Error: Received fatal alert: access_denied url=https://rep o.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-lang/scala-library/2.11.8 /ivys/ivy.xml ,但不应该使用它。

答案 1 :(得分:0)

用作流操纵器的

std::endl实际上是一个函数。

您可能会通过此操作获得类似或相关的错误消息

 void f();   // don't need to define f()

 int main()
 {
      f;    //   should be f() to call the function
 }

删除语句endl;