10 Replies Latest reply on Feb 3, 2017 5:32 AM by MartyG

    Error in new Project SDK R3

    MQMQ

      Hi,

       

      I'm new with the Intel SDK R3. I have an SR300 camera and I want to prove some code on it. I'm trying to create my own project based on the sample 'CameraViewer.cpp' and it doesn't work.

       

      The error that appears is "LINK2001 external symbol PXCSession_CreateFromPath unsolved".

       

      The code I put in the new project is this one:

       

      #include <windows.h>

      #include "RealSense/SenseManager.h"

      #include "RealSense/SampleReader.h"

      #include "util_cmdline.h"

      #include "util_render.h"

      #include <conio.h>

       

      using namespace Intel::RealSense;

      int wmain(int argc, WCHAR* argv[]) { //int main()// int wmain() //int main()//

      /* Creates an instance of the SenseManager */
      SenseManager *pp = SenseManager::CreateInstance();
      if (!pp) {
        wprintf_s(L"Unable to create the SenseManager\n");
        return 3;
      }

       

      return 0;

      }

       

      Can anyone help me?

       

      Thanks in advance,

        • 1. Re: Error in new Project SDK R3
          MartyG

          One of the causes of the LNK2001 compiler error can apparently be when you are asking the program to look for something that does not exist.  I'll do my best to work through possible causes with you.

           

          The first thing I would try is to remove the line #include <conio.h>, as this is apparently a legacy instruction related to old MS-DOS compiler programs and is not needed by modern C compilers and is not part of the C standards.

          • 2. Re: Error in new Project SDK R3
            MQMQ

            Thanks for the answer!

             

            I remove that line and It's still not working... I have another error (that appears before too)

             

            -LNK2001 external symbol PXCSession_CreateFromPath unsolved

            -LNK11201 1 external unsolved

            • 3. Re: Error in new Project SDK R3
              MartyG

              Are you using a C# compiler?  There is apparently no need for includes in the C# language - they are used in C and C++ languages.

               

              Confirmed: CameraViewer.cpp is a C++ program.  There does not seem to be a C# version of it.

               

              Sample: CameraViewer [C++]

               

              This is fine if you are using a C++ compiler.  If you are trying to use this listing in a C# compiler though, it would be like trying to run Windows programs on an iPhone.

              • 4. Re: Error in new Project SDK R3
                MQMQ

                I've created a new project based on C++ in Visual Studio, so I think I'm using a right compiler.

                • 5. Re: Error in new Project SDK R3
                  MartyG

                  Ok, that's good to know.  A couple of people fixed that error just by creating a new project file and copy-and-pasting their listing into the new project file.  So that quick test may be worth trying.

                  • 6. Re: Error in new Project SDK R3
                    MQMQ

                    Sorry, maybe I'm goint to make a fool question but, what do you mean about "their listing"?

                    • 7. Re: Error in new Project SDK R3
                      MartyG

                      There's no such thing as a silly question.    I mean copying and pasting their program code. 

                       

                      I went back to my copy of the old RealSense PDF 'Getting Started' manual from 2014 and found this C++ code listing that creates the SenseManager like you are trying to do.

                       

                      #include <windows.h>

                      #include <wchar.h>

                      #include "pxcsensemanager.h"

                      int wmain(int argc, WCHAR* argv[]) {

                      // create the PXCSenseManager

                      PXCSenseManager *psm=0;

                      psm = PXCSenseManager::CreateInstance();

                      if (!psm) {

                      wprintf_s(L"Unable to create the PXCSenseManager\n");

                      return 1;

                      }

                      // Retrieve the underlying session created by the PXCSenseManager.

                      // The returned instance is an PXCSenseManager internally managed object.

                      // Note: Do not release the session!

                      PXCSession *session;

                      session = psm->QuerySession();

                      if (session == NULL) {

                      wprintf_s(L"Session not created by PXCSenseManager\n");

                      return 2;

                      }

                      // query the session version

                      PXCSession::ImplVersion ver;

                      ver = session->QueryVersion();

                      // print version to console

                      wprintf_s(L" Hello Intel RSSDK Version %d.%d \n",ver.major, ver.minor);

                      // enumerate all available modules that are automatically loaded with the RSSDK

                      for (int i=0;;i++) {

                      PXCSession::ImplDesc desc;

                      if ( session->QueryImpl(0,i,&desc) < PXC_STATUS_NO_ERROR ) break;

                      // Print the module friendly name and iuid (interface unique ID)

                      wprintf_s(L"Module[%d]: %s\n",i,desc.friendlyName);

                      wprintf_s(L" iuid=%x\n",desc.iuid);

                      }

                      // close the streams (if any) and release any session and processing module instances

                      psm->Release();

                      system(“pause”);

                      return 0;

                      }

                      • 8. Re: Error in new Project SDK R3
                        MQMQ

                        I've copied and pasted your code and compiled in my project and the same error appears... :/

                        • 9. Re: Error in new Project SDK R3
                          MartyG

                          Here is the page from the manual on setting up a RealSense C++ development environment.  Please check it to see if you have done it all.

                           

                          1.jpg

                          • 10. Re: Error in new Project SDK R3
                            MQMQ

                            Ok, that was the mistake... now it works fine, thanks!

                            • 11. Re: Error in new Project SDK R3
                              MartyG

                              Great, glad I could help.  Good luck!