c++ - 向函数添加一个参数后编译 C++ 程序时出现问题

标签 c++

我所做的只是向这个函数添加了一个参数(迭代):

/**
 * saveImage : save the last image received.
 * @param pName name of the file
 */
void GVMsample::saveImageLocal(const std::string& pName, const std::string& pImageFormat, const int &iterations) {

  // Check that a video module has been registered.
  if (!fRegisteredToVim) {
    throw ALError(getName(), "saveImageLocal()",  "No video module is currently "
      "registered! Call registerToVIM() first.");
  }

#ifdef GENERICVIDEOMODULE_IS_REMOTE_ON
  // If this module is running in remote mode, we shouldn't use saveImageLocal.
  throw ALError(getName(), "saveImageLocal()", "Module is run in remote mode, "
    "use saveImageRemote instead !");
#else

  ALImage* imageIn = NULL;

  for ( int iter = 0; iter < iterations; iter++ )
  {
      // Now you can get the pointer to the video structure.
      imageIn = (ALImage*) (fCamProxy->call<int>("getImageLocal", fGvmName));

      if (!imageIn) {
        throw ALError(getName(), "saveImageLocal", "Invalid image returned.");
      }

      fLogProxy->info(getName(), imageIn->toString());

      // You can get some image information that you may find useful.
      const int width = imageIn->fWidth;
      const int height = imageIn->fHeight;
      const int nbLayers = imageIn->fNbLayers;
      const int colorSpace = imageIn->fColorSpace;
      const long long timeStamp = imageIn->fTimeStamp;
      const int seconds = (int)(timeStamp/1000000LL);

      // Set the buffer we received to our IplImage header.
      fIplImageHeader->imageData = (char*)imageIn->getFrame();

      saveIplImage(fIplImageHeader, pName, pImageFormat, seconds);

      // send image over UDP to the PC
      // we will use udt
  }

  // Now that you're done with the (local) image, you have to release it from the V.I.M.
  fCamProxy->call<int>("releaseImage", fGvmName);

#endif
}

函数在头文件中是这样定义的:

/**
 * saveImage : save the last image received.
 * @param pName name of the file
 */
void saveImageLocal(const std::string& pName, const std::string& imageFormat, const int &iterations);

我收到这个错误:

alt text

当我去掉这个参数时,它再次编译正常。

最佳答案

如错误所述,gvnsample.h 第 51 行的原型(prototype)是错误的。您忘记更新它,或者您修改了错误的文件。

关于c++ - 向函数添加一个参数后编译 C++ 程序时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4200477/

相关文章:

c++ - C++中的源文件和头文件

c++ - 使用套接字从嵌入式设备播放 RTP 流

c++ - std::vector 和 llvm::SmallVector 有什么区别?什么时候使用哪一个?

c++ - 在模板中指定允许的参数

c++ - 如何将 std::set 的元素添加到另一个非空集?

c++ - 双重锁定解决方法

C++ std::string::assign 工作起来很奇怪

python - 如何在 Windows GUI 应用程序中将嵌入式 Python 连接到控制台的 I/O?

c++ - AVL Tree - 计算 N_Nodes 按位置打印元素 c++

c++ - 使用 C++ 中的函数初始化 const bool 数组