0

I am building a project using mrpt. I am linking the windows binaries in a c++ project, visual studio 2015, 64 bit. When I run this code, to create a window:

//.h

        #include <mrpt/opengl.h>
        #include <mrpt/opengl/CPointCloudColoured.h>
        #include <mrpt/gui.h>
        #include <mrpt/utils/CConfigFile.h>
        #include <mrpt/utils/CConfigFileBase.h>
        using namespace mrpt;
        using namespace mrpt::gui;
        using namespace mrpt::poses;
        using namespace mrpt::utils;
        using namespace mrpt::math;
        using namespace mrpt::opengl;

...

public:

    CDisplayWindow3D* win;

//.cpp (in constructor of class).

win = new CDisplayWindow3D("Scene",1920,1080);

I get a crash, with this:

Exception thrown at 0x00007FFA6F012356 (libmrpt-gui156_msvc140_x64.dll) in dataset.exe: 0xC0000005: Access violation reading location 0x000000000000AE18.

I have these include paths:

C:\Program Files\mrpt-1.5.6\libs\hwdrivers\include
C:\Program Files\mrpt-1.5.6\libs\graphs\include
C:\Program Files\mrpt-1.5.6\libs\vision\include
C:\Program Files\mrpt-1.5.6\libs\obs\include
C:\Program Files\mrpt-1.5.6\libs\maps\include
C:\Program Files\mrpt-1.5.6\libs\gui\include
C:\Program Files\mrpt-1.5.6\libs\opengl\include
C:\Program Files\mrpt-1.5.6\libs\base\include
C:\Program Files\mrpt-1.5.6\include\mrpt\mrpt-config

and these libs linked:

libmrpt-base156_msvc140_x64.lib
libmrpt-opengl156_msvc140_x64.lib
libmrpt-gui156_msvc140_x64.lib
libmrpt-maps156_msvc140_x64.lib
libmrpt-obs156_msvc140_x64.lib
libmrpt-vision156_msvc140_x64.lib
libmrpt-graphs156_msvc140_x64.lib
libmrpt-hwdrivers156_msvc140_x64.lib

Why is this crashing? What am I doing wrong here?

Thank you.

Machavity
  • 30,841
  • 27
  • 92
  • 100
anti
  • 3,011
  • 7
  • 36
  • 86
  • Hi, Could you build in "Debug"? Are you using CMake to automatically set all your include dirs and linking libs? That's strongly recommended... otherwise, it's easy to mistakenly link against a wrong lib version (e.g. debug vs release). After building in Debug, try launching in debug mode and see what's the exact stack call at the crash point. – Jose Luis Blanco Jun 19 '18 at 22:33
  • Hi, thank you for getting back to me. I am using cmake, and have the includes and libs above.I am using mrpt from binaries, mrpt-1.5.6. The call stack at the break is `> plslam_dataset.exe!PLSLAM::slamScene::slamScene(std::basic_string,std::allocator > configFile) Line 65 C++ ` – anti Jun 29 '18 at 15:28
  • I can't see any obvious reason for the crash... I would recommend trying to build MRPT from sources instead of using the prebuilt binaries... perhaps it's an issue with slightly different versions of the compiler (?)... – Jose Luis Blanco Jul 02 '18 at 04:53
  • Hi, sorry for the huge delay. i have now built from source, and i see the same issue. as soon as I initialize the window, it will crash. Can you think of anything I can try here? Thanks! – anti Jul 17 '18 at 19:39
  • AHA, when I run the track video example, i get: ` track-video-features - Part of MRPT MRPT C++ Library: MRPT 1.5.0 - Sources timestamp: 2018-07-17 ------------------------------------------------------------------- You didn't specify any video source in the command line. (You can run with --help to see usage). Showing a GUI window to select the video source... =============== MRPT EXCEPTION ============= mrpt::hwdrivers::prepareVideoSourceFromUserSelection, line 1231: MRPT compiled without wxWidgets` Could this be causing my crash? – anti Jul 17 '18 at 19:48
  • 1
    ...and indeed it was. Building from source with wxWidgets has solved this. Thanks for your time. – anti Jul 17 '18 at 20:36

0 Answers0