Ask Your Question

OpenCV with Qt support namedWindow crash

asked 2012-07-16 09:26:35 -0500

frondeur gravatar image

updated 2012-07-24 02:36:07 -0500

Kirill Kornyakov gravatar image


I've opencv 2.4.2 build with visual studio 2010 and CMAKE (qt support enabled). Whenever, i use a simple program opening a window/use imshow then i get unhandled exception crash and in the terminal window i get opencv error :

OpenCV error: Null pointer <null session="" handler=""> in unknown function, file, pathtoopencv\highgui\src\window_qt.cpp line 909

The same program with the same configuration settings work in 'Release' configuration. It only fails in Debug mode. I also tried to build the opencv with SSE/SSE2 disabled but still am getting the crash.


edit retag flag offensive close merge delete


Can you please post whole CMAKE configuration? I compiled the openCV with Qt like two weeks ago, I remember I had some kind of problems too, not exactly like yours, but I fixed it by rolling back a version and changed something in cmake configuration, I should still have it I'll take a look.

XCoder gravatar imageXCoder ( 2012-07-16 09:31:00 -0500 )edit

I am having the same problem, any update on the situation?

Baris Evrim Demiroz gravatar imageBaris Evrim Demiroz ( 2012-08-08 10:12:31 -0500 )edit

Try rolling back a version if you are using 2.4.2. The compiling part, at least for me, is always a very tricky thing to do.

XCoder gravatar imageXCoder ( 2012-08-09 03:09:38 -0500 )edit

4 answers

Sort by ยป oldest newest most voted

answered 2012-08-09 09:26:18 -0500

Baris Evrim Demiroz gravatar image

I have found the problem and a workaround.

In OpenCV solution, in opencv_highgui Debug properties, remove QtCore4.dll from the Linker->Input->Additional Dependencies. Recompile OpenCV-Debug. Use the new dll files.

I have also filed a bug report here.

edit flag offensive delete link more

answered 2013-03-05 21:48:07 -0500

Jevin gravatar image

Check out the following video about configuring opencv and QT

helped me a lot hope will do same for you ;-)

edit flag offensive delete link more

answered 2012-07-23 03:54:01 -0500

XCoder gravatar image

updated 2012-07-23 03:56:09 -0500

Well I'm not exactly sure what causes your problem, I compared my CmakeCache with yours, and it looks like you have compiled a lot of plugins inside Qt. This experiment might take a half a day :), but maybe try recompiling Qt with the configuration like in the installation documentation:

configure.exe -release -no-webkit -no-phonon -no-phonon-backend -no-script -no-scripttools
              -no-qt3support -no-multimedia -no-ltcg

Check if your environment variable called QTDIR, and environment path pointing something similar to this:


Another thing I saw, your CUDA might not be working. By the way, what compiler were you using to compile OpenCV?

It might help you to compare those cmake files yourself, download notepad++ and install compare plugin, and here are my and your CMakeCache files and text document pointing out differences worth taking a deeper look into: cmakecaches.rar

Maybe try, to follow the instruction videos again in the installation documentation, maybe you missed something, anyway GOOD LUCK.

edit flag offensive delete link more

answered 2012-07-21 13:09:29 -0500

frondeur gravatar image

Sorry for late reply, i forgot to check the follow on for the message. I tried to upload the cmakecache.txt, if it is what you meant by config but i can not upload it due to forum restrictions. So i am posting it here.

# This is the CMakeCache file.
# For build in directory: c:/opencv/build
# It was generated by CMake: C:/Program Files/CMake 2.8/bin/cmake.exe
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.

# EXTERNAL cache entries

//Path to a program.

//Create build rules for OpenCV Documentation

//Build all examples

//Build libjasper from source

//Build libjpeg from source

//Enables 'make package_source' command

//Build performance tests

//Build libpng from source

//Build shared libraries (.dll/.so) instead of static ones (.lib/.a)

//Build accuracy & regression tests

//Build libtiff from source

//Include debug info into debug libs (not MSCV only)

//Enables use of staticaly linked CRT for staticaly linked OpenCV

//Build zlib from source

//Include opencv_calib3d module into the OpenCV build

//Include opencv_contrib module into the OpenCV build

//Include opencv_core module into the OpenCV build

//Include opencv_features2d module into the OpenCV build

//Include opencv_flann module into the OpenCV build

//Include opencv_gpu module into the OpenCV build

//Include opencv_highgui module into the OpenCV build

//Include opencv_imgproc module into the OpenCV build

//Include opencv_legacy module into the OpenCV build

//Include opencv_ml module into the OpenCV build

//Include opencv_nonfree module into the OpenCV build

//Include opencv_objdetect module into the OpenCV build

//Include opencv_photo module into the OpenCV build

//Include opencv_stitching module into the OpenCV build

//Include opencv_ts module into the OpenCV build

//Include opencv_video module into the OpenCV build

//Include opencv_videostab module into the OpenCV build

//Semicolon separated list of supported configuration types, only
// supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything
// else will be ignored.

//C++ compiler

//Flags used by the compiler during all build types.

//Flags used by the compiler during debug ...
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2012-07-16 09:26:35 -0500

Seen: 5,999 times

Last updated: Mar 05 '13