Panda3D and load_model c++ - c++

I am new to panda3d and am trying the hello world.
I have gotten the program to run with just:
PandaFramework framework;
framework.open_framework(argc, argv);
WindowFramework *window = framework.open_window();
framework.main_loop();
framework.close_framework();
return 0;
however, if I add in :
NodePath environt = window->load_model(framework.get_models(), "panda-model");
environt.reparent_to(window->get_render());
environt.set_scale(0.25, 0.25, 0.25);
environt.set_pos(-8, 42, 0);
before the main_loop(), it won't compile. I have the panda-model.egg.pz in every folder of my c++ project but every time my program breaks on :
environt.reparent_to(window->get_render());
The excat message is: Unhandled exception at 0x0152a317 in Irr.exe: 0xC00001A5: An invalid exception handler routine has been detected.
It compiles fine the only wraning being that it can't find the pdb files but that doesn't matter.
Any ideas?
Btw, im using MSVC++ 2010 and panda3d 1.7.2
The only error I can find is : First-chance exception at 0x00bfa317 in Irr.exe: 0xC0000005: Access violation reading location 0x737265db.
Unhandled exception at 0x00bfa317 in Irr.exe: 0xC00001A5: An invalid exception handler routine has been detected.
The program '[8476] Irr.exe: Native' has exited with code 0 (0x0).
which I'm pretty sure is still rather vague. I'm sorry but its all I can find. I'd be happy to describe it more though if necessary.

Microsoft Visual C++ 2010 is not supported by current versions of Panda3D. You will need to use 2008 or compile the Panda3D SDK from source against MSVC 2010. (This is not as straightforward as it sounds, as you will also need to compile some of the thirdparty packages to be compatible with 2010. However, it is possible.)
If you insist on using 2010 instead of 2008, this forum post may be helpful:
https://www.panda3d.org/forums/viewtopic.php?t=12663

Related

Facing some issues in debugging ASIFT algorithm in C++ on Visual Studio 2019

Hope you are well and safe. I found an implementation of ASIFT in C++ online(http://www.mattsheckells.com/opencv-asift-c-implementation/). But for some reason, i am getting errors during runtime. I have tried and tested the same on 32 bit version with an older opencv(2.4.9), it is running fine however its slow. Now I want to test it on new opencv versions (3x,4x) but till now no success. I am using VS 2019 and compiling opencv using cmake in windows. For Opencv 3.x to access sift libraries, i am using opencv_contrib of the same version and compiling together. But there are no conclusive results. I hope you can guide me on this. I can let you know how i set things up in further edits.
The exact step where the debugging fails and error have been posted here.
//cv::xfeatures2d::SiftFeatureDetector detector;
Ptr<cv::xfeatures2d::SiftFeatureDetector> detector = makePtr<cv::xfeatures2d::SiftFeatureDetector>();
//Ptr<cv::xfeatures2d::SiftFeatureDetector> detector = cv::xfeatures2d::SiftFeatureDetector::create();
//detector.detect(timg, kps, mask);
detector->detect(timg, kps, mask);---- the program stops debugging error due to a memory error
"Unhandled exception at 0x00007FFDEC899709 in Project1_asift.exe: Microsoft C++ exception: cv::Exception at memory location 0x000000E5A319DDB8."
and i get this printed on the console:
"OpenCV(3.4.2) Error: The function/feature is not implemented () in cv::Feature2D::detectAndCompute, file c:\build\3_4_winpack-build-win64-vc15\opencv\modules\features2d\src\feature2d.cpp, line 154"
Hope to get a positive response.

Visual Studio C++ Cannot load Symbols and access violation when debugging

I am having a very strange issue. I have a c++ project that was working just fine until today. Today I tried to run the visual studio debugger and at the very beginning of the main function, I get an access violation exception. The line where the exception occurs varies, though it is always in the first few lines of my main function. Visual studio claims the source file is not available.
I'm not sure what changed, although recently, upon opening the visual studio project, I was presented with a message about finding a suitable location for he pdb, which i naively clicked "ok" to.
In case this helps, the call stack is:
ntdll.dll!_RtlInitUnicodeStringEx#8()
KernelBase.dll!LoadLibraryExW()
KernelBase.dll!_LoadLibraryW#4()
kernel32.dll!#BaseThreadInitThunk#12()
ntdll.dll!__RtlUserThreadStart()
ntdll.dll!__RtlUserThreadStart#8()
Edit:
I tried a new empty project. Literally:
// TestProj.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main()
{
return 0;
}
and I get a similar error.

MatLab C++ Shared Dll Library Initialization Crash

I am using Matlab 2013a and Visual Studio 2013. I am trying to use MatLab compiled dll from a C++ console application. My simple Matlab test dll and console application is compiled for 64bit machines (I made sure they are 64bit via dumpbin). I also have correct version of MCR installed on my machine (even if it's not necessary).
I setup my compiler using "mbuild -setup" command.
I compile my .m file using this command line: "mcc -v -W cpplib:mylib -T link:lib myFunc" successfully.
In my console application, I include these libraries: mylib.lib, mclmcrrt.lib, mclmcr.lib, libmx.lib, libmat.lib and use the libraries in this path "C:\Program Files\MATLAB\R2013a\extern\lib\win64\microsoft"
When I debug my program, it successfully initializes MCR using this call: "mclInitializeApplication(NULL, 0)" but when I call "mylibInitialize()" in order to initialize my library, program crashes. It doesn't even throw an axception therefore I cannot handle it using try/catch block. It gives unhandled exception and access vialoation error message.
These are sample debug output messages I got;
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: xercesc_2_7::NoSuchElementException at memory location 0x000000E263EF4E48.
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: xsd_binder::MalformedDocumentError at memory location 0x000000E263EF4E40.
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: xercesc_2_7::NoSuchElementException at memory location 0x000000E263EF4E48.
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: boost::thread_interrupted at memory location 0x000000E2643FF630.
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: boost::thread_interrupted at memory location 0x000000E2642FFCD0.
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: CryptoPP::AES_PHM_Decryption::InvalidCiphertextOrKey at memory location 0x000000E264EFB0F0.
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: tfFailedException at memory location 0x000000E264EF4C10.
First-chance exception at 0x00007FFA22761F08 in MatlabTest.exe: Microsoft C++ exception: varflowFailedException at memory location 0x000000E264EF9410. The thread 0x3550 has exited with code 0 (0x0). 'MatlabTest.exe' (Win32): Loaded 'C:\Program Files\MATLAB\R2013a\bin\win64\hgbuiltins.dll'. Cannot find or open the PDB file.
First-chance exception at 0x0000000000B46E60 (m_interpreter.dll) in MatlabTest.exe: 0xC0000005: Access violation reading location 0x0000000064EF3B90. Unhandled exception at 0x0000000000B46E60 (m_interpreter.dll) in MatlabTest.exe: 0xC0000005: Access violation reading location 0x0000000064EF3B90.
The program '[12952] MatlabTest.exe' has exited with code 0 (0x0).
I installed MCR to another machine and tried to run this console application. I got the same result.
I tried Loren's Vigenere example too,
http://blogs.mathworks.com/loren/2011/02/03/creating-c-shared-libraries-and-dlls/#respond
It didn't work either.
Do you have any idea why this is happening?
Thanks
It seems problem is MATLAB and Visual Studio version mismatch. If I use MatLab 2016a with Visual Studio 2013, there is no problem and everything works perfectly.
I had the similar problem with Matlab2017 + VS 2015.
Probably there is some conflict with java used by MATLAB.
I've fixed it by using
const char *args[] = {"-nojvm"};
const int count = sizeof(args) / sizeof(args[0]);
mclInitializeApplication(args, count))
instead of
mclInitializeApplication(NULL,0)

Problems with including afxmt.h in VC++ 2010

I'm getting exceptions when I include afxmt.h, I know it's not my code because I tested it with an empty project that only included that file.
It first throws a first-chance exception (mfc100ud.dll) and then it jumps to thrdcore.cpp AfxInitThread() and then goes to tidtable.c
Is there some project settings that I'm missing or some other stuff? I'm using VC++ 2010 Professional.
First-chance exception at 0x00b794ea (mfc100ud.dll) in Quick_Test.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x77b815de in Quick_Test.exe: 0xC0000005: Access violation reading location 0x00000000.
Stops at thrdcore.cpp line 405 and then in tidtable.c line 500.
EDIT:
Just tested this with a project that has precompiled headers and it worked. How would I make it work on my other projects, that were originally empty? Or should I just use a project with precompiled headers?
One reason could be that you are using release and trying to access the debug dll. Debug dlls usually ends with a "d" letter

Access violation reading location 0xcccccccc

I am trying to run the squares.cpp example in the openCV 2.2. The code compiles and builds without errors in Visual Studio 2008. However when I run the executable (i.e., during run time) I am getting a error stating
Unhandled exception at 0x004ac363 in OpenCVRectangle.exe: 0xC0000005: Access violation reading location 0xcccccccc.
This occurs at the definition:
vector<vector<Point> > squares;
in the main function
Can somebody help, why this occurs?
I figured out that the value 0xcccccc usually is an uninitialized or bad variable, but do not understand why I get this exception at this line.
The full example code can be found at http://pastebin.com/MTaXVcQz
Your code runs fine on Mac OS X with OpenCV 2.3.0, but OpenCV is known to present different behaviors in different Operating Systems.
First, check if your code has this problem in both Release and Debug versions.
Upgrade to OpenCV 2.3.1 on Windows and see if the problem goes away.
namedWindow in the code you linked to is a function which doesn't look defined in this scope. It might be that it's trying to interpret as a variable which has not been defined, rather than a function. I would say it's missing some sort of library perhaps? It's difficult to say without further context, but vector<vector<Point> > squares; should not be a violation.
Press Ctrl + Alt + E in VS, enable all exceptions checking, run it in debug mode and see the place where the exception is rised. This should be enough for understanding.