0

main.cpp

#include "NiHandViewer.h"


//---------------------------------------------------------------------------
// Defines
//---------------------------------------------------------------------------
#define SAMPLE_XML_PATH "../../../Data/SamplesConfig.xml"


//---------------------------------------------------------------------------
// Globals
//---------------------------------------------------------------------------
xn::Context     g_context;
xn::ScriptNode  g_scriptNode;


int main(int argc, char* argv[])
{
    XnStatus                rc;
    xn::EnumerationErrors   errors;

    // Create a context with default settings
    rc = g_context.InitFromXmlFile(SAMPLE_XML_PATH, g_scriptNode, &errors);
    if (rc == XN_STATUS_NO_NODE_PRESENT)
    {
        XnChar strError[1024];
        errors.ToString(strError, 1024);
        printf("%s\n", strError);
        return (rc);
    }
    else if (rc != XN_STATUS_OK)
    {
        printf("Open failed: %s\n", xnGetStatusString(rc));
        return (rc);
    }

    SimpleViewer& viewer = HandViewer::CreateInstance(g_context);

    rc = viewer.Init(argc, argv);
    if (rc != XN_STATUS_OK)
    {
        printf("Viewer init failed: %s\n", xnGetStatusString(rc));
        return 1;
    }

    rc = viewer.Run();
    if (rc != XN_STATUS_OK)
    {
        printf("Viewer run failed: %s\n", xnGetStatusString(rc));
        return 1;
    }

    return 0;
}

I tried compiling it. g++ main.cpp -o main and got:

NiSimpleViewer.h:25:10: fatal error: XnCppWrapper.h: No such file 
or directory                                                      cker$ APTOP-QIFEOL3I:/mnt/c/Program 
   25 | #include <XnCppWrapper.h>
Gerhardh
  • 11,688
  • 4
  • 17
  • 39
  • This is no C code. C and C++ are diferent languages. Please only use related tags – Gerhardh Jan 18 '21 at 19:50
  • What have you tried? Do you have the file in question? Is the folder in the list of include directories? – Gerhardh Jan 18 '21 at 19:52
  • Looks like you're going to need a `-I` and probably `-l` and `-L` options to tell the build tools what libraries to link in and where they are. – user4581301 Jan 18 '21 at 20:04
  • Okay so it took me a while but I found the library it is at the path ```C:\Program Files\OpenNI\Samples\NiHandTracker\Libs```. So I typed ```-I``` into the terminal and got the error bash: syntax error near unexpected token `newline'. The same thing also happened for both -l and -L. –  Jan 18 '21 at 21:54
  • @NealSmalley Don't include the `<` and `>` symbols. If you're in a bash terminal on Windows, you'll need to use the path that bash is aware of (it might be `/mnt/c/Program....`, `/c/...`, etc, depending on your setup). – nanofarad Jan 18 '21 at 23:32

0 Answers0