Invalid overload - error [message #951506] |
Sat, 20 October 2012 20:06 |
Aidin Hassanzadeh Messages: 2 Registered: October 2012 |
Junior Member |
|
|
Hey,
I got wired errors for a simple macro. I am following a tutorial on a sample OpenNi project. The code is ok while not using Eclipse
errors:
Invalid overload of 'CHECK_RC(nRetVal, "Find depth generator")'
'waht' was not declared in this scope
What could be wrong?
Thanks!
Aidin
// includes
#include <iostream>
#include <XnOpenNI.h>
#include <XnLog.h>
#include <XnCppWrapper.h>
#include <XnFPSCalculator.h>
#include <XnOSCpp.h>
// defines
#define XML_PATH "/home/aydin/workspace//DepthRead/config/DepthXML.xml"
// macros
#define CHECK_RC(rc, what) \
if (rc != XN_STATUS_OK) { \
std::cout<<waht<<" failed: "<< xnGetStatusString(rc)<< std::endl; \
return rc; \
}
using namespace xn;
XnBool fileExists(const char *fn) {
XnBool exists;
xnOSDoesFileExist(fn, &exists);
return exists;
}
int main() {
// XN_STATUS_OK: Definition of the OK error code.
XnStatus nRetVal = XN_STATUS_OK;
Context context;
ScriptNode scriptNode;
EnumerationErrors errors;
const char *fn = NULL;
if(fileExists(XML_PATH)) fn = XML_PATH;
else{
std::cout <<"Could not find " << XML_PATH << ". Aborting.\n" << std::endl;
return XN_STATUS_ERROR;
}
std::cout << "Reading config from: \n" << fn << std::endl;
nRetVal = context.InitFromXmlFile(fn, scriptNode, &errors);
if (nRetVal == XN_STATUS_NO_NODE_PRESENT) {
XnChar strError[1024];
errors.ToString(strError, 1024);
std::cout << strError << std::endl;
return (nRetVal);
}
else if (nRetVal != XN_STATUS_OK) {
std::cout << "Open failed: " << xnGetStatusString(nRetVal) << std::endl;
return (nRetVal);
}
// initialize the depth generator node
DepthGenerator depth;
nRetVal = context.FindExistingNode(XN_NODE_TYPE_DEPTH, depth);
CHECK_RC(nRetVal, "Find depth generator");
// initialize the FPS calculator
XnFPSData xnFPS;
nRetVal = xnFPSInit(&xnFPS, 180);
CHECK_RC(nRetVal, "FPS Init");
DepthMetaData depthMD;
while(!xnOSWasKeyboardHit) {
nRetVal = context.WaitOneUpdateAll(depth);
if (nRetVal != XN_STATUS_OK) {
std::cout << "Update data failed: ";
std::cout << xnGetStatusString(nRetVal) << std::endl;
continue ;
}
xnFPSMarkFrame(&xnFPS);
depth.GetMetaData(depthMD);
std::cout << "Frame " << depthMD.FrameID();
std::cout << "middle point is: ";
std::cout << depthMD(depthMD.XRes()/2, depthMD.YRes() / 2);
std::cout << ". FPS: ";
std::cout << xnFPSCalc(&xnFPS) << std::endl;
}
depth.Release();
scriptNode.Release();
context.Release();
return 0;
}
|
|
|
Re: Invalid overload - error [message #951755 is a reply to message #951506] |
Sun, 21 October 2012 01:00 |
David Wegener Messages: 1445 Registered: July 2009 |
Senior Member |
|
|
On 10/20/2012 03:07 PM, Aidin Hassanzadeh wrote:
> Hey,
>
> I got wired errors for a simple macro. I am following a tutorial on a
> sample OpenNi project. The code is ok while not using Eclipse
>
> errors:
> Invalid overload of 'CHECK_RC(nRetVal, "Find depth generator")'
> 'waht' was not declared in this scope
>
>
> What could be wrong?
>
> Thanks!
> Aidin
>
> // includes
> #include <iostream>
> #include <XnOpenNI.h>
> #include <XnLog.h>
> #include <XnCppWrapper.h>
> #include <XnFPSCalculator.h>
> #include <XnOSCpp.h>
>
> // defines
> #define XML_PATH "/home/aydin/workspace//DepthRead/config/DepthXML.xml"
>
> // macros
> #define CHECK_RC(rc,
> what) \
> if (rc != XN_STATUS_OK)
> { \
> std::cout<<waht<<" failed: "<< xnGetStatusString(rc)<<
> std::endl; \
> return
> rc; \
> }
>
>
> using namespace xn;
>
>
> XnBool fileExists(const char *fn) {
> XnBool exists;
> xnOSDoesFileExist(fn, &exists);
> return exists;
> }
>
> int main() {
> // XN_STATUS_OK: Definition of the OK error code.
> XnStatus nRetVal = XN_STATUS_OK;
> Context context;
> ScriptNode scriptNode;
> EnumerationErrors errors;
>
> const char *fn = NULL;
>
> if(fileExists(XML_PATH)) fn = XML_PATH;
> else{
> std::cout <<"Could not find " << XML_PATH << ". Aborting.\n" <<
> std::endl;
> return XN_STATUS_ERROR;
> }
>
> std::cout << "Reading config from: \n" << fn << std::endl;
> nRetVal = context.InitFromXmlFile(fn, scriptNode, &errors);
>
> if (nRetVal == XN_STATUS_NO_NODE_PRESENT) {
> XnChar strError[1024];
> errors.ToString(strError, 1024);
> std::cout << strError << std::endl;
> return (nRetVal);
> }
> else if (nRetVal != XN_STATUS_OK) {
> std::cout << "Open failed: " << xnGetStatusString(nRetVal) <<
> std::endl;
> return (nRetVal);
> }
>
> // initialize the depth generator node
> DepthGenerator depth;
> nRetVal = context.FindExistingNode(XN_NODE_TYPE_DEPTH, depth);
> CHECK_RC(nRetVal, "Find depth generator");
>
> // initialize the FPS calculator
> XnFPSData xnFPS;
> nRetVal = xnFPSInit(&xnFPS, 180);
> CHECK_RC(nRetVal, "FPS Init");
>
> DepthMetaData depthMD;
>
> while(!xnOSWasKeyboardHit) {
> nRetVal = context.WaitOneUpdateAll(depth);
> if (nRetVal != XN_STATUS_OK) {
> std::cout << "Update data failed: ";
> std::cout << xnGetStatusString(nRetVal) << std::endl;
> continue ;
> }
>
> xnFPSMarkFrame(&xnFPS);
>
> depth.GetMetaData(depthMD);
>
> std::cout << "Frame " << depthMD.FrameID();
> std::cout << "middle point is: ";
> std::cout << depthMD(depthMD.XRes()/2, depthMD.YRes() / 2);
> std::cout << ". FPS: ";
> std::cout << xnFPSCalc(&xnFPS) << std::endl;
>
> }
>
> depth.Release();
> scriptNode.Release();
> context.Release();
>
> return 0;
> }
The 'waht' you have in the macro body doesn't match the 'what' you have
in the macro argument definition.
My guess is that the 'waht' that is being passed to cout should be
changed to 'what'
|
|
|
Powered by
FUDForum. Page generated in 0.02834 seconds