Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Invalid overload - error
Invalid overload - error [message #951506] Sat, 20 October 2012 20:06 Go to next message
Aidin Hassanzadeh is currently offline Aidin HassanzadehFriend
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 Go to previous message
David Wegener is currently offline David WegenerFriend
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'
Previous Topic:Double click on error in console does not jump to error
Next Topic:Problem with right-click behaviour
Goto Forum:
  


Current Time: Fri Apr 19 23:42:22 GMT 2024

Powered by FUDForum. Page generated in 0.02834 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top