How do I build Qt 3.X.X on Windows? - c++

I downloaded a project that depends on Qt 3.X.X (legacy version). I downloaded this version from the Qt downloads archive and set the environment variables according to what the documentation tells me. I can't build the program though. The errors I get are all along the lines of
Moc'ing SomeFile.h ...
The system cannot find the path specified.
Looking into the Qt /lib folder, there's just one README file that says
If this directory is empty, you forgot to build the Qt library
I'm assuming this is the reason I can't build my project, so I would like to know how to build this Qt version. The documentation is extremely limited since it's an old version, so I can't get it to work based on that.
Some system info:
Windows 10
x64
Visual Studio 2015 installed
If you need more info, please let me know!

Related

MinGW Installation Manager - Missing devpropdef.h file

I downloaded the MinGW Installation Manager and installed most of the packages available there in trying to find the 'devpropdef.h' file.
This file is needed by the openframeworks library and without it, I cannot compile the most basic project.
This file was listed by one of the contributors in this thread, but I don't know what happened to it.
Does anyone know which package it is in from the MinGW installation manager? Or how I can get my hands on it?
The http://winlibs.com/ build of GCC/MinGW-w64 has a very recent version of MinGW-w64 which contains devpropdef.h.

Build OpenCV for UWP

I'm currently struggling to build OpenCV for the UWP.
I already googled quite a lot and found Microsoft's OpenCV Github Repo which tecnically should do the magic. However, this repo and pretty much everything else I found in this regard are outdated (Visual Studio 2015, old OpenCV versions etc.). I need to use OpenCV 3.3 because it's a cross platform project and I don't want to recompile everything else solely because of an outdated git repo.
Can anyone explain the process of building OpenCV using CMake from the official repo for the UWP?
My first attempt was to simply use the Windows Dlls, however my application than shouts "Failed to load module" at me. Then, I tried to build OpenCV the Visual Studio Project files as stated here and here. However, this doesn't do it for me as it throws the following error:
CMake Error at cmake/OpenCVUtils.cmake:440 (if):
if given arguments:
"(" "OR" "OFF" ")"
Unknown arguments specified
Call Stack (most recent call first):
CMakeLists.txt:317 (OCV_OPTION)
It also tells me to check the CMakeOutput.log but there it's 0 errors everywhere.
If someone could tell me either how to get rid of this error or what to change in the CMake GUI to build OpenCV for UWP, that'd be great!
Edit:
I also tried to compile OpenCV with a platform specific toolchain for WinRT as found in platforms/winrt. It doesn't really change anything though (I'm not even sure if it should), I still get "Unable to load Dll: The specified module could not be found". Maybe GPPK is right in his assumption that it's more an UWP problem than an OpenCV one. Anyways, if anyone knows anything about this, I'd really love to get some help!
Ok, I didn't get an answer yet, so I managed to do it myself (more or less).
Here's how I did it:
Prerequisites
Visual Studio (2017)
UWP SDK
CMake
OpenCV from official repo
Steps
Create a build folder which you want the UWP libraries to built in.
Start PowerShell in this folder and execute the following command (exchange C:\OpenCV with your local OpenCV path): cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERS
ION="10.0" -DCMAKE_VS_EFFECTIVE_PLATFORMS=x86 -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF C:\OpenCV
If you get the same error message as I did (see question for more details), go to the root CMakeLists.txt in the OpenCV folder and add a # in front of line 317 (OCV_OPTION(ENABLE_PYLINT)). This should fix it, to check, execute the command from above once more.
Ensure that the output claims "Windows RT support YES" and "Building for Microsoft platform: Windows".
Open OpenCV.sln in the build folder. Ensure that all projects are either of type "Windows Store" or "Universal Windows" and build the ALL_BUILD Project twice: Once in Release configuration, and once in Debug. Then build the INSTALL Project.
That's it, you should find the built Dlls in the install folder. Step 3 is probably a bug in OpenCV and will hopefully be fixed in upcoming versions.

Unable to build for Windows on Linux, with MinGW

Because I am not a Java enthusiast, I decided to use C++ and Qt for one of my projects. However, I came across the big cross-compiling Qt problem, and I am unable to produce an .exe file for Windows users.
My setup
Linux Ubuntu 12.04, with Wine and Qt. qmake -v gives the following output :
QMake version 2.01a
Using Qt version 4.8.1 in /usr/lib/x86_64-linux-gnu
I also have a MinGW32 compiler, which can be found at /usr/bin/i586-mingw32msvc-g++. My Wine drive_c folder contains the following Qt directories :
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/Src
$HOME/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32
The mingw48_32 directory contains the necessary include/ and lib/ directories, which are used in my mkspec file, /usr/share/qt4/mkspecs/win32-x-g++/qmake.conf :
QMAKE_INCDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/include
QMAKE_LIBDIR_QT = /home/me/.wine/drive_c/Qt/Qt5.2.0/5.2.0/mingw48_32/lib
The problem
According to most guides I've found about Qt cross-compiling, my setup should be enough to run a simple :
qmake -spec win32-x-g++
make
wine /path/to/my/application.exe
But... nothing's linked. QApplication and every other symbol I use in my program are "not found". No QApplication, no QPushButton, no connect(), no SIGNAL(), no SLOT()...
My objective here is to successfully configure QtCreator to use this setup (in an independent build configuration), so that it can build a Linux executable (through the first and working configuration), and a Win32 .exe (through the MinGW setup above). However, I cannot modify a single build step in QtCreator :
Cannot add a "MinGW" toolchain : it is not available in the "Add" dropdown list.
Cannot change the -spec parameter value in the project build configurations panel. The field is non-editable.
Despite guides and solutions I found all over the Internet, my only solution so far is to send my source code to a virtual Windows machine, and have it create a new project with it. On this VM, I could probably compile for Windows... But of course, this doesn't actually sound like a real "solution" to me...
Is there any way Qt(Creator) has finally made cross-compiling easier now ? I'm getting a bit tired of "symbol not found" errors...
First,
sudo apt-get install mingw-w64
Then, check if Qt Creator finds the toolchain.
Next, until Ubuntu starts providing a mingw-w64-qt package, download the Qt source and build it. This is bound to get messy, and maybe even the simplest thing to do is to install WINE and use a Windows Qt version.

build problems with Qt and opencv on Windows

I would like to create a gui application with Qt, using opencv on Windows XP. I used both Qt and opencv before, but never together. Long story short, I'm unable to get opencv work with Qt.
As on all the forums I searched there are just little pieces of information scattered around, usually with no answer, I summarize here all the steps I've taken.
Downloaded the Qt SDK (4.6.3) for Windows, and used it for some time, successfully.
Downloaded the opencv 2.3.1 megapack for Windows, complete with binaries. I managed to compile my Qt project including opencv successfully, but any opencv function call resulted in a crash. I read on some forums that the binaries in the Windows megapack don't support Qt, and I have to build opencv myself
I downloaded the latest version of CMake (2.8).
I downloaded the source of opencv from here: http://code.opencv.org/svn/opencv/branches/2.3/
I downloaded the source for the version of Qt I had (4.6.3)
I found my old version of visual Studio 2005
I created a VS2005 project with CMake, checking the support for Qt. (WITH_QT checked)
I built opencv in VS2005. It created most of the libraries, but not all. Highgui was among the failed ones. The problem: Qt\4.6.3\src\corelib\global\qconfig.h was not found. There was no qconfig.h at all in the source I downloaded! I found some templates qconfig-large.h, qconfig-small.h etc., so I renamed one of them to qconfig.h. Now I got a screen full of linker errors.
I downloaded the latest Qt source instead (4.8.1). Now there is a source file qbenchmark.h that includes QtTest/qbenchmarkmetric.h which cannot be found.
I gave up, and tried MinGW.
I downloaded the latest MinGW (2011.11.18)
I set CMake to generate a MinGW makefile, but I got the following error:
.
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-g++.cmake:1 (INCLUDE):
include could not find load file:
C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/Platform/Windows-gcc.cmake
Call Stack (most recent call first):
C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/CMakeCXXInformation.cmake:59 (INCLUDE)
True, there is a Windows-g++.cmake file in the Modules/Platform directory, but it references Windows-gcc.cmake which does not exist!
Is there anyone who managed to build opencv with Qt support on Windows, and if yes, how?
Edit:
The problem is definitely with the Qt source. I managed to generate a MinGW makefile, and the build went all OK until it stopped in src/testlib/qtestsystem.h because there was an include for QtCore/qelapsedtimer.h which file is in a completely different directory! Does Qt release incomplete sources, or did I do something wrong?
Edit2
My torment continues. I cleaned everything and started anew. This time without even trying Visual Studio.
I downloaded the latest Qt libs with source (4.8.1)
I downloaded the latest MinGW (2011.11.18)
With CMake I successfully created a Makefile, and built it with MinGW. I got some shiny new libs (libopencv_core231, etv.). I was very happy, but how wrong I was to celebrate that soon!!
I downloaded the latest Qt SDK (strangely, it was 4.8.0, so I set Qt Creator to use the 4.8.1) and created a test program without opencv to see if it works. It worked!
I tried using opencv, just reading and displaying an image. It didn't work. exited with code -1073741511
I tried running the .exe directly, outside of Qt Creator. It complained of a missing libstdc++-6.dll
I did a search for it, and found on in my MinGW install (c:\mingw\bin, 958 KB), and one in my Qt install (c:\qt\mingw\bin, 793 KB) - this mingw came bundled with Qt.
I tried both, by copying them in the same folder where my .exe is, but neither worked. I got "The procedure entry point _ZNSt9exceptionD2Ev could not be located in the dynamic link library libstdc++-6.dll." with both. This was in debug, so I tried release, and I got a similar error, with some other entry point not found.
I searched the forums, and I found suggestions that I should link libstdc++ statically. I inserted -static-libgcc -static-libstdc++ at the lines QMAKE_LFLAGS = and QMAKE_LFLAGS_DEBUG = in the file c:\Qt\mkspecs\win32-g++\qmake.conf. This had no effect at all, even after restarting Qt Creator and rebuilding. If I don't copy the libstdc++-6.dll, it still requires it.
Of course, my simple test program without opencv runs from the exe without needing any libstdc++-6.dll, so that means my opencv build is responsible? I wanted to build opencv anew, but I cannot find any CMake settings referring to libstdc++ !
It might be a clue:
When using one of the libstdc++-6.dll files, the error about a missing entrypoint mentions QtGui4.dll. I have a debug build, so it should be QtGui*d*4.dll, shouldn't it? Are there different libstdc++s for debug and release? Either way, I tried to build release, but it didn't work either, same error
Is there no single person on this planet who tried using Qt with QtCreator and opencv 2.3 together on Windows xp, and succeeded? From searching all the forums and Qt archives, I could not find anyone. I'm ready to do the development in Linux, but I'll need a Windows release sooner or later anyway.
I'm trying to resist the temptation of the dark side, which whispers into my ears to forget Qt, MinGW, g++, opencv and try to hack together something in Visual Basic. Oh, the horrors!
Just FYI, I went basically through the same nightmare of combining Qt and OpenCV. This was my experience:
I downloaded the Qt SDK 4.7.4 with Qt Creator 2.4.1 and installed it, no problem.
I downloaded and installed OpenCV 2.4.2 and not knowing that it already came with MinGW...
I downloaded the MinGW compiler which of course had a different version than the one which came already with Qt
This completely messed up my CMake, even when I explicitly told CMake to use the Qt gcc.exe and g++.exe it also used some stuff from my freshly installed MinGW. Probably because I eagerly added every directory to my PATH variable. What a fool I was!
CMake was not able to generate any useful files, so I gave up and installed the OpenCV superpack, hoping this would make things easier.
6.I spent hours wondering, why Qt and OpenCV from the superpack didnt work properly together. I never quite understood. I had the same errors that other users describe here, like console programs crashing as soon as some OpenCV was included. The strange thing is, that I could start the executable manually from FileExplorer (I added all .dlls you could think of to the project folder: opencv_core242.dll, opencv_highgui242.dll, QtCore4.dll, QtGui4.dll and so on...) BUT I could not launch my little test program from within the Qt Creator environment.
I analysed if there was a problem with my DLLs using depends.exe and found out that even though I configured everything to be in DEBUG using the MinGW compiler, my program still tried to use QtCore4.dll and not QtCore4d.dll... So my best guess was, that it was mixing debug and release version.
I gave up using the superpack and again tried to use CMAKE first and then build OpenCV using the Qt MinGW version AND making sure to setup everything for Debug mode and enable the QT option. But no luck with that so far
I stopped using MinGW and switched over to MSVC2010, which works better. However I am still not able to debug the program since the MSVC2010 debugger engine seems to be missing. I dont really know how to manually add this but I am still working on it
So what I can definitely tell is that using Qt and OpenCV for somebody who has little experience is far from trivial!
You should build OpenCV from source, as you already did, it is no hassle. Note that recent versions of OpenCV can be built with and w/o Qt. Highgui optionally uses Qt! It is your choice if you build with or without Qt.
I used Qt libraries together with OpenCV for long time now. I never went for the SDK, instead I used the libs which are built for corresponding VS version. See here: http://qt.nokia.com/downloads/downloads#qt-lib
You can have it for VS2008 and VS2010, but earlier versions are also available built for VS2005. Old versions of Visual Studio suck so hard, why use them anyway.
Then I never had problems pulling it together in a CMake project. It goes along the lines of:
find_package(OpenCV)
find_package(Qt4 ${VOLE_MINIMUM_QT_VERSION} COMPONENTS QtCore QtGui)
find_package(Qt4 ${VOLE_MINIMUM_QT_VERSION} COMPONENTS QtOpenGL)
...
qt4_wrap_cpp(moc_sources ${vole_module_moc_sources})
qt4_wrap_ui(uic_sources ${vole_module_ui_sources})
qt4_add_resources(rcc_sources ${vole_module_rcc_sources})
You know, the usual stuff.
Five man weeks later you may probably get it run under Windows, while under GNU/Linux it is three commands in the shell.
You might have an easier time configuring Qt Creator with OpenCV. This post shows how to achieve that, step-by-step! It displays several screenshots to aid in the process too.

Has anyone had any luck compiling this .NET binding for Mapnik?

So I'm trying to build this library that is a .NET binding for Mapnik http://mapnik.org.
I ran the "../ext/install.cmd" file successfully but I think that only builds
the boost library for c++. When I run the visual studio solution for it afterwards it still has like 900 errors!
Mostly in 1 class for text rendering.
http://sourceforge.net/projects/mapniknet/
I would love to use this library if anyone can help me get the build to run succesfully.
My system:
Win7 64bit
On systems older than Windows 7 patching can not be run if there are spaces in "Program Files" folder name.
You can patch mapnik and ICU sources manually applying Mapnik.patch on MapNik folder and icu_vs2010.patch on icu one.
If sources were changed previously they should be reverted before patching.
After patching rerun install.cmd