开发者

Problem compiling C++ program after adding one argument to a function

All I did was I added a single more argument (iterations) to this function:

/**
 * 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开发者_C百科 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
}

The functions is defined like this in the header file:

/**
 * 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);

And I am getting this error:

Problem compiling C++ program after adding one argument to a function

When I take that argument away it compiles ok again.


As the error says, the prototype on line 51 of gvnsample.h is wrong. You forgot to update it, or you modified the wrong file.


Ok. I have figured out the problem. I was editing the right file. But...

I was editing the file in Windows 7 in a folder shared with Ubuntu 10.10. I was then trying to compile the program in Ubuntu through VirtualBox.

The problem was for some reason I need to reboot the virtual machine or else the files in the shared folder don't get updated when I rewrite them in Windows (when I rewrite a file in Ubuntu the changes are visible in Windows right away but the other way around reboot is needed - strange).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜