C++ 编译C+时出现问题+;将一个参数添加到函数后的程序
我所做的只是向该函数添加了一个或多个参数(迭代):C++ 编译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
/**
* 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
}
我得到了这个错误:
当我去掉那个参数时,它再次编译正常。正如错误所说,gvnsample.h第51行的原型是错误的。您忘记更新它,或者您修改了错误的文件。确定。我已经解决了这个问题。我正在编辑正确的文件。但是 我在Windows7的一个与Ubuntu 10.10共享的文件夹中编辑这个文件。然后我试图通过VirtualBox在Ubuntu中编译程序
问题是出于某种原因,我需要重新启动虚拟机,或者在Windows中重写共享文件夹中的文件时,共享文件夹中的文件不会得到更新(当我在Ubuntu中重写文件时,这些更改在Windows中立即可见,但需要以另一种方式重新启动-奇怪).我想您已经尝试过从头开始清理和重建了?看起来您实际上并没有更改.h文件。您确定编辑的是正确的。试着把fooobaaar放进去,看看编译器是否启动了that@Oli不是真的。这不是我的职责。这是我正在使用的库中的函数,除非绝对必要,否则我不想编辑它的文件。请不要通过常量引用传递ints。这是毫无意义的。按价值传递它们。它们适合任何32位体系结构上的寄存器。可以说,传递const引用可能会让天真的编译器感到悲观。哇,那种共享文件夹设置听起来像是灾难的秘诀。除了幻影更新之外,行尾和时间戳以及各种各样的东西都会有问题。你考虑过像Git这样的DVCS吗?不,它当然可以工作。不过,您必须将这两个系统视为两个不同的系统:在Windows中将驱动器导出为网络共享,在Ubuntu中将其装载为Samba共享。双方都明白,网络驱动器可能会发生意外变化。
/**
* 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);