Software Archive
Read-only legacy content
17061 Discussions

NewBie Question

Aman_p_
Beginner
1,279 Views

Hi Im a noob here, Im just starting out with realsense and c++ too actually. Im sorry if this question is a waste of time for you guys, but I probably cant help it and this is my last resort.

Thanks in advance.

 

I started to add realsenses abilities in a c++ project, but Im stuck at the first step. I did search through this forum first but couldnt find an answer (probably coz it was too dumb). I also tried to look at the FAQ section but i think that link is broken.

 

SO the error I get is at the very beginning when I try to create an Instance

 

Error    2    error LNK2019: unresolved external symbol _PXCSession_Create@0 referenced in function "public: static class PXCSenseManager * __cdecl PXCSenseManager::CreateInstance(void)" (?CreateInstance@PXCSenseManager@@SAPAV1@XZ)    C:\Users\Administrator\Desktop\Project1\Project1\w32main.obj    Project1

Error    3    error LNK1120: 1 unresolved externals 

 


I have tried some other mods to calling it but everytime it just fails at the create Instance line, Someone please tell me where Im going wrong.

 

I included the pxcsensemanager.h file and there are no errors to that linking.

With the other header files , I have these
//#include <windows.h>
//#include <wchar.h>
//#include "pxcsensemanager.h"

IN the middle of the program somewhere I have this
//// Create a SenseManager instance.
//PXCSenseManager *sm;
//sm = PXCSenseManager::CreateInstance();

 

This is all commented out to make sure rest of my program is working ok, and it is.

If this is too dumb, can someone atleast guide me to the right example I can follow, Ive been trying to follow the tutorials. And they compile just fine.

Again, Im sorry if this is too dumb.

Thanks

0 Kudos
8 Replies
Jack_K_1
New Contributor II
1,279 Views

Aman,

Take a look at page 8 of the Getting Started pdf.  The linkage error you are getting is probably because Visual Studio does not know which libraries to load and where they are located.   If you follow the instructions on page 8, you will add properties to your project that will tell Visual Studio what it needs to know.

Regards,

Jack

0 Kudos
Aman_p_
Beginner
1,279 Views

 

Thanks for your reply Jack,

​I did actually do the property sheet add and I reckoned that if they weren't attaching the pxcsensemanager.h won't be recognized coz its not present in the project directory, It is getting the lib and dir info I believe.

Do you have any other suggestions? Thanks for your input btw.

 

Aman

0 Kudos
Jack_K_1
New Contributor II
1,279 Views

Aman,

PXCSession_Create is in libpxc.cpp; it uses the registry to locate libpxcsession.dll and then loads it.  The source is available.  Did you rebuild it?  I have not needed to.

I've had trouble trying to duplicate your error message.  I got close by adding VS2010-13.Integration.MD.props to the project and then modifying property "Code Generation>Runtime Library" to "Multi-threaded Debug (/MTd)", i.e. to use static libraries.

Which prop template did you use?  If you used VS2010-13.Integration.MD.props, check to make sure that property "Code Generation>Runtime Library" is set to "Multi-threaded Debug DLL (/MDd)" for the debug config and try rebuilding in debug mode.

If you didn't used VS2010-13.Integration.MD.props, try using it in a new project.

Regards,

Jack

0 Kudos
Aman_p_
Beginner
1,279 Views

Jack,

​I used the static property template VS2010-13.Integration.MT.props instead of the dynamic one.

I did not rebuild or anything

 

I can try with the "MD" and then see maybe that works and check the /MDd too.

 

Thanks,

I'll update you on the results I get with the MD

 

0 Kudos
Jack_K_1
New Contributor II
1,279 Views

Aman,

I was able to exactly reproduce the link error message you reported while trying to add the Real Sense SDK to a DirectX project.  After several failed attempts to modify the property settings to be compatible with the library, I decided to just copy the source file libpxc.cpp from C:\Program Files (x86)\Intel\RSSDK\src\libpxc, add it to my project and rebuild. 

So far this solution is working - I've been able to enable some features, initialize the camera and acquire some frames.  I'll let you know if I run into problems.

Why don't you try this solution and see if it works for you?

Regards,

Jack

0 Kudos
Aman_p_
Beginner
1,279 Views

Thanks for your reply Jack, that did help.

I copied libpxc into my folder and included it in the main function to compile with the project.

However, now I have errors related to pxcCHAR, specifically:

Error    3    error C2664: 'BOOL GetModuleHandleExA(DWORD,LPCSTR,HMODULE *)' : cannot convert argument 2 from 'LPCWSTR' to 'LPCSTR'    c:\users\administrator\desktop\project1\project1\libpxc.cpp    75    1    Project1

 

Error    4    error C2664: 'DWORD GetModuleFileNameA(HMODULE,LPSTR,DWORD)' : cannot convert argument 2 from 'pxcCHAR [260]' to 'LPSTR'    c:\users\administrator\desktop\project1\project1\libpxc.cpp    76    1    Project1

 

Error    1    error C2664: 'HMODULE IsolationAwareLoadLibraryA(LPCSTR)' : cannot convert argument 1 from 'pxcCHAR *' to 'LPCSTR'    c:\users\administrator\desktop\project1\project1\libpxc.cpp    32    1    Project1

 

Im not sure if it is actually reaching the part where I create an instance in another file, So Im not 100% sure if the error has left me yet. But since you were able to get it working after the same error, maybe it will work.

Do you have any suggestion on this error here?

 

Im very tempted to quit this and try javascript , but after you recreated the error and was able to get rid of it makes me see light at the end of the tunnel.

 

 

 

0 Kudos
Jack_K_1
New Contributor II
1,279 Views

Aman,

It looks like your project is setup to use Character Set ANSI.  Try changing it to Unicode.

Regards,

Jack

0 Kudos
Aman_p_
Beginner
1,279 Views

I tried to change the encoding of all the files but in the process broke something, so my poject now has other issue. Im trying to fit it and then see if the encoding thing works, I will keep you updated.

 

Thanks

0 Kudos
Reply