0xc000007b Error Solution

Two days ago I was working on a C++ project using OpenCV, when suddenly my project couldn’t run anymore!

I just have changed my OpenCV dlls to parallel version and ended up with this Error: "The application was unable to start correctly (0xc000007b). Click OK to close the application." every time I tried to run my application.

0xc000007b-error

After some hours of hard search I found that 0xc000007b error didn’t come from an exception in my code or even OpenCV dlls. I found that the error is just wrong configurations and the solution is easy, so I decided to write this article to show you how you cans solve this error permanently.

The Problem

0xc000007b error comes mainly from mixing up 32bit environment with 64bit one, that is you have an 32bit application that tries to load a 64bit dll.

Read the rest of this entry »

Building Qt Applications using your favorite text editor

I have used C++ for about 5 years now, and it is really a very powerful programming language. But I found one big disadvantage; it is too hard to make a C++ GUI. I used to do that by Windows API, but it is difficult to learn and I can’t learn my students all Windows API concepts for just making some forms and buttons!

Recently I heard about Qt and decided to learn it. As usual I stuck at the beginning; how could I build a Qt Application? and as usual too I do it my way 😉

Building Qt Applications using Notepad

If your favorite text editor is still Notepad!, you must build your Qt Applications using command line.

To let it easy to you, I made a batch file depends on what compiler you want to use to build Qt Applications.

Building Qt Opensource Version using MingW

If you are using Qt Opensource Version you can use this batch file to build and run Qt Applications:

::::::::::::::::::::::: This is Qt building batch by Madhat Alsoos :::::::::::::::::::::::
:: First argument is the directory of the project
:: Second argument is the name of the cpp file without .cpp

@echo off
cd %1
set QTDIR=%1
set PATH=C:\Qt\2009.04\qt\bin;C:\Qt\2009.04\bin;C:\Qt\2009.04\mingw\bin;C:\WINDOWS\System32;%PATH%
set QMAKESPEC=win32-g++
qmake -project
qmake
mingw32-make.exe
IF not ERRORLEVEL 1 start debug\%2.exe

You can use this batch by passing the directory of the .cpp file and its name like this:

build.bat c:\qt\test\helloworld helloworld

It is so easy! First set Qt base directory to directory of file which we want to build (which will be passed as an argument to this batch file), then add Qt installation directory to the PATH system variable (just in case) and set QMAKESPEC to win32-g++ which tells Qt that it should make the project for g++ compiler. After that we make the .pro file (Qt project file) and compile it using mingw32 (which came by default with your Qt open source verison).

Note that you must change Qt path in this batch to where you installed Qt, or simply add your Qt bin folders to PATH system variable.

Building Qt Commercial Version using Visual Studio

If you are using Qt Commercial Version you can use this batch file to build and run Qt Applications:

Read the rest of this entry »

QtNpp: Notepad++ Plugin to build Qt Applications

I really love Qt and began to learn it recently, but I didn’t find a way to build Qt files from inside Notepad++ so as usual I made mine 😉

QtNpp is my Notepad++ plugin to build and run Qt applications.

Notepad++  Qt

The idea

The idea of QtNpp is simple; just build the file by using these lines:

@echo off
set QTDIR=%1
set PATH=C:\Qt\2009.04\qt\bin;C:\Qt\2009.04\bin;C:\Qt\2009.04\mingw\bin;C:\WINDOWS\System32;%PATH%
set QMAKESPEC=win32-g++
qmake -project
qmake
mingw32-make.exe

but the implementation of QtNpp is not that simple!

By default QtNpp try to build Qt files by using the above script which works in one of these cases:

Read the rest of this entry »