小编Ali*_*ien的帖子

C++ 中的错误:类构造函数的重新定义

我在尝试编译时遇到了这两个错误。

\n\n

谁知道怎么了?

\n\n

我在想也许我 #include 错误的头文件吗?\n代码和错误示例如下:

\n\n

错误:

\n\n
Square.cpp:8: error: redefinition of \xe2\x80\x98Square::Square(bool, Point*, std::string, int)\xe2\x80\x99\nSquare.h:21: error: \xe2\x80\x98Square::Square(bool, Point*, std::string, int)\xe2\x80\x99 previously defined here\nSquare.cpp: In member function \xe2\x80\x98Point Square::getCoord()\xe2\x80\x99:\nSquare.cpp:22: error: expected primary-expression before \xe2\x80\x98]\xe2\x80\x99 token\nSquare.cpp: In member function \xe2\x80\x98void Square::setCoord(Point*)\xe2\x80\x99:\nSquare.cpp:32: error: expected primary-expression before \xe2\x80\x98]\xe2\x80\x99 token\nSquare.cpp:32: error: expected primary-expression before \xe2\x80\x98]\xe2\x80\x99 token\n
Run Code Online (Sandbox Code Playgroud)\n\n

.cpp文件

\n\n
#include "Square.h"`\n#include <cmath>\nusing namespace std;\n\nSquare::Square(bool containsWarpSpace, Point coord[], string shapeName, int vertPoint):ShapeTwoD(shapeName, containsWarpSpace) {\n\n vertPoint = vertPoint;\n coord[] = coord[];\n\n}\n\nint Square::getVertPoint()\n{\n    return vertPoint;\n}\n\nPoint …
Run Code Online (Sandbox Code Playgroud)

c++

2
推荐指数
1
解决办法
1万
查看次数

命令未找到错误

我收到一个错误,command not found不知道有什么问题.我认为我的代码存在问题.我需要用户输入付款.第一个用户输入ID,然后程序将找到具有该ID的人.然后程序会找到他[雇员,或每小时]的雇员类型然后从那里进入 if [$type="Salaried"]或' Hourly'编码并提示用户键入相应的数据

请告诉我该怎么做呢?

payroll()
{
  line=`grep -i "^${update_empID}," $data`
  empID=`echo $line | cut -d "," -f1`
  name=`echo $line | cut -d "," -f2`
  job=`echo $line | cut -d "," -f3`
  phone=`echo $line | cut -d "," -f4` 
  type=`echo $line | cut -d "," -f5`

   clear
   echo -e "Enter the pay"
   echo -en "Enter ID: "
   read empid_search

   #Check if particular entry to search for existed to perform deletion
   if [ `count_lines "^${empid_search},"` …
Run Code Online (Sandbox Code Playgroud)

bash ubuntu

1
推荐指数
1
解决办法
106
查看次数

标签 统计

bash ×1

c++ ×1

ubuntu ×1