Building a program

MSVC – Microsoft Visual Studio Compiler

MING – Minimalist GNU for indows

GCC – GNU Compiler Collection

.

Project File

“Qt Creator includes a project manager that uses a cross platform project file format (.pro). A project file can contain information such as what files are included into the project, custom build steps and settings for running the applications.”  [Wikipédia]

Example of project file to use OpenCV Library : ProjectFile.pro  

#——————————————————————————-
#
# Project created by QtCreator 2012-10-26 T22:41:17
#
#——————————————————————————-

QT       +=   core
QT       -=    gui
TARGET            =   Canny
CONFIG         +=   console
CONFIG          -=   app_bundle
TEMPLATE      =   app
SOURCES       +=   main.cpp
INCLUDEPATH     +=     “C:\OpenCV2.1\include\opencv”               ( include files.h type)       
LIBS       +=      “C:\OpenCV2.1\lib\*.*”                                                  ( dll files path )

 

look for “qmake reference documentation” for mor details,    http://qt-project.org/doc/qt-4.8/qmake-reference.html

.

QMake variable reference

look for Qmake reference documentation :   http://qt-project.org/doc/qt-5.0/qtdoc/qmake-variable-reference.html

Qmake manual  http://qt-project.org/doc/qt-5.0/qtdoc/qmake-manual.html

qmake.conf

QT
CONFIG
SOURCES
INCLUDEPATH
LIBS                                   etc…

.

.

QImage

Converting IplImage <-> QImage

http://www.developer.nokia.com/Community/Wiki/Using_OpenCV_with_Qt

.

Qt command prompt / configure options

http://qt.developpez.com/doc/5.0-snapshot/configure-options/

http://blog.eonsoft.us/?p=538

Qt-Console

.

PreProcessor

.

MINGW

http://qt-project.org/wiki/MinGW
http://www.mingw.org/wiki/Getting_Started

.

Tip & Tricks

1. Need to rerun qmake after modifying the PRO file.
… run qmake to create a new makefile for the application

2. Quand vous exécutez votre programme depuis Qt Creator, la position des DLL est « connue », donc votre programme se lance sans erreur. Pour pouvoir lancer l’exécutable depuis l’explorateur (et aussi pour qu’il marche chez vos amis et clients), il faut placer les DLL qui manquent dans le même dossier que l’exécutable. 

3. .. Headers (any .h, .hpp, or any other extension I can’t remember right now) are not compiled. They are only included by .cpps, so it doesn’t really matter what extension they have, as long as the compiler knows it’s not supposed to compile it.

Typically,     C  applications use .h and .c
C++  use .hpp and .cpp   (pp = plus plus).

Repository of Opencv source files           https://code.ros.org

.

.

Deploying an Aplication on Windows

http://qt-project.org/doc/qt-5.0/qtdoc/deployment-windows.html
…If you want to keep things simple by only having a few files to deploy, i.e. a stand-alone executable with the associated compiler specific DLLs, then you must build everything statically…

Dependency Walker – free software   –   http://www.dependencywalker.com/

Dependency Walker is a free utility that scans any 32-bit or 64-bit Windows module (exe, dll, ocx, sys, etc.) and builds a hierarchical tree diagram of all dependent modules. For each module found, it lists all the functions that are exported by that module, and which of those functions are actually being called by other modules. Another view displays the minimum set of required files, along with detailed information about each file including a full path to the file, base address, version numbers, machine type, debug information, and more.

Dependency Walker is also very useful for troubleshooting system errors related to loading and executing modules. Dependency Walker detects many common application problems such as missing modules, invalid modules, import/export mismatches, circular dependency errors, mismatched machine types of modules, and module initialization failures.

Image2

.

Static Compilation / Shared Compilation

Build statically
Dynamic builds

Shared compilation share DLL´s with other programs. Some of these DLL´s are part of Windows.
Dynamic linking offers two advantages:

  • Often-used libraries (for example the standard system libraries) need to be stored in only one location, not duplicated in every single binary.
  • If a library is upgraded or replaced, all programs using it dynamically will immediately benefit from the corrections. Static builds would have to be re-linked first.

Static Compilation – all DLL´s are inside .exe file, zero dependencies.

The benefit of static builds is their portability : once the final executable file has been compiled, it is no longer necessary to keep the library files that the program references, since all the relevant parts are copied into the executable file. As a result, when installing a statically-built program on a computer, the user doesn’t have to download and install additional libraries: the program is ready to run.

.

DLLs

DLL’s are specific to the operating system (version). (forum)
You will notice that most system DLL’s actually are in C:\Windows\WinSxS and those in “System32” are just hard-links.  (forum)

Actually pretty much all applications use the C Runtime libraries, those compiled with Visual Studio use the MSVCRT???.DLL that ships with the individual version of Visual Studio. And apps compiled with MinGW/GCC use MSVCRT.DLL, i.e. the one that is part of the Windows operating system.  (forum)

About Qt plug-in DLL’s, please have a look at:
http://qt-project.org/doc/qt-4.8/plugins-howto.html#locating-plugins

.

Process Explorer

If you want a complete list of all DLL’s that are currently loaded by a running process, use Process Explorer.

Download Process Explorer ( application )    http://technet.microsoft.com/en-gb/sysinternals/bb896653.aspx
(Enable “show lower pane” and set “lower pane view” to “DLLs”, then select the desired process from above)

Ever wondered which program has a particular file or directory open? Now you can find out. Process Explorer shows you information about which handles and DLLs processes have opened or loaded.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

Leave a comment