How to add successfully pcl library to a qt project with qmake - c++

i am trying to include pcl library to my qt application project using qmake. I found some similar questions, however none of the answers help to solve my problem.
I have tried to add to the .pro file the paths from pcl lib as well as the 3rd party libraries which are used by pcl. Here is the include lines of my .pro file.
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/lib
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/3rdParty/Eigen/bin
win32:CONFIG(release, debug|release): LIBS += -LD:/Libraries/PCL_1.6.0/3rdParty/Boost/lib
INCLUDEPATH += D:/Libraries/PCL_1.6.0/include/pcl-1.6
DEPENDPATH += D:/Libraries/PCL_1.6.0/include/pcl-1.6
INCLUDEPATH += D:/Libraries/PCL_1.6.0/3rdParty/Eigen/include
DEPENDPATH += D:/Libraries/PCL_1.6.0/3rdParty/Eigen/include
INCLUDEPATH += D:/Libraries/PCL_1.6.0/3rdParty/Boost/include
DEPENDPATH += D:/Libraries/PCL_1.6.0/3rdParty/Boost/include
After that, i am just trying put this include to one of my files:
include pcl/io/pcd_io.h
And these are the errors i am getting back:
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:604: error: unable to find string literal operator 'operator""X' with 'const char [2]', 'long long unsigned int' arguments
EIGEN_ASM_COMMENT("mybegin2");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:640: error: unable to find string literal operator 'operator""X' with 'const char [2]', 'long long unsigned int' arguments
EIGEN_ASM_COMMENT("myend");
D:\Libraries\PCL_1.6.0\3rdParty\Eigen\include\Eigen\src\Core\products\GeneralBlockPanelKernel.h:644: error: unable to find string literal operator 'operator""X' with 'const char [2]', 'long long unsigned int' arguments
EIGEN_ASM_COMMENT("mybegin4");
Can you please help me to solve the problem?

I suggest to use CMake. See the links below:
These are two examples provided by PointCloudLibrary with CMake: qt_colorize_cloud and qt_visualizer.
Here is the explanation for the configuration in Qt.
The CMakeList.txt is as follows:
cmake_minimum_required(VERSION 2.8.11)
project(pcl_visualizer)
# init_qt: Let's do the CMake job for us
set(CMAKE_AUTOMOC ON) # For meta object compiler
set(CMAKE_AUTORCC ON) # Resource files
set(CMAKE_AUTOUIC ON) # UI files
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# Find the QtWidgets library
find_package(Qt5 REQUIRED Widgets)
find_package(VTK REQUIRED)
find_package(PCL 1.7.1 REQUIRED)
# Fix a compilation bug under ubuntu 16.04 (Xenial)
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
include_directories(${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})
set(project_SOURCES main.cpp pclviewer.cpp)
add_executable(${PROJECT_NAME} ${project_SOURCES})
target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES} Qt5::Widgets)
Hope it will help you.

Related

how to convert qmake.pro file to cmake [duplicate]

I have a .pro file on my project, but now I want to port it to a CMakeLists.txt file. How can I do this?
QT += core
QT -= gui
CONFIG += c++11
TARGET = test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
QT += network
SOURCES += main.cpp \
test_interface.cpp \
motomanlibrary.cpp \
processing.cpp
SOURCES += main.cpp \
test_interface.h \
motomanlibrary.h \
processing.h
QMake: The required libraries.
QT += core
QT -= gui
QT += network
CMake: only the add is necessary. An exclude (QT -= gui) is not required.
find_package(Qt5Core REQUIRED)
find_package(Qt5Network REQUIRED)
QMake: Additional Compiler flags:
CONFIG += c++11
CMake: Extend the list of compiler flags as required.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
QMake: The source files
SOURCES += main.cpp \
test_interface.cpp \
motomanlibrary.cpp \
processing.cpp
CMake: Create a list of source files
set(SOURCES
main.cpp
test_interface.cpp
motomanlibrary.cpp
processing.cpp
)
QMake: The header to be included:
SOURCES += main.cpp \
test_interface.h \
motomanlibrary.h \
processing.h
CMake: Just show where the header files are.
include_directory(.) # or include_directory(${CMAKE_CURRENT_SOURCE_DIR})
include_directory(some/where/else)
QMake: The target to be built:
TARGET = test
CMake: Set the name of the target, add the sources, link the required libs.
add_executable(test ${SOURCES} )
qt5_use_modules(test Core Network) # This macro depends from the Qt version
# Should not be necessary
#CONFIG += console
#CONFIG -= app_bundle
#TEMPLATE = app
See further details on Convert qmake to cmake
There is a python script to convert QMake to CMake on a WIP branch of Qt Base: https://code.qt.io/cgit/qt/qtbase.git/tree/util/cmake/pro2cmake.py?h=wip/cmake
It will probably be released with Qt 6 when CMake will become the main build system.
This is what you would typically write in a simple Qt application built with cmake consuming Qt. A few gotchas:
Use automoc. This reduces the maintenance overhead significantly. It is also fast enough even for large projects so that you do not need to care about build-time slow-down.
Use versionless cmake targets so that they are compatible across Qt versions.
If you can, take advantage of the QT_DISABLE_DEPRECATED_BEFORE variable.
As a bonus, enable some usual warning, error and sanitizer detections if you aim for high quality.
You may or may not want to add a Qt 5 fallback in case anyone would like to use your software with Qt 5. This requirement may phase out slowly, but surely.
project(Application VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
find_package(Qt6 COMPONENTS Widgets)
if (NOT Qt6_FOUND)
find_package(Qt5 5.15 REQUIRED COMPONENTS Widgets)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "(Clang|GNU)")
add_compile_options(-Wall -Wpedantic -Wextra -Werror)
add_compile_options(-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer)
add_link_options(-fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set_property(DIRECTORY APPEND PROPERTY COMPILE_OPTIONS "/w")
endif()
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0xFFFFFF)
add_executable(Application
mainwindow.cpp
main.cpp
)
target_link_libraries(Application Qt::Widgets)

Linking with jack using qmake

I have two similar projects on the same machine. Their difference is that one is using GUI (Qt and Qwt) and the other is not. As the result, the one that has Qt is using qmake to compile and the other one cmake.
The project itself is about signal processing and working with audio. I decided to use RtAudio for capturing audio signal. I can compile and run the example code fine when I'm compiling with cmake but when I try to compile the other project using qmake, it fails.
The problem is jack (audio library) which is not found when compiling using qmake. But first, let's start with the project that works. Here's what I have in my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.18)
project(cli_test)
set(CMAKE_CXX_STANDARD 17)
add_executable(cli_test main.cpp)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(arecord PRIVATE Threads::Threads)
target_link_libraries(arecord PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/fftw/lib/libfftw3.a)
include_directories(./rtaudio/include/rtaudio)
#list(GET LIB_TARGETS 0 LIBRTAUDIO)
set(LINKLIBS)
list(APPEND LINKLIBS ${ALSA_LIBRARY})
list(APPEND INCDIRS ${ALSA_INCLUDE_DIR})
target_link_libraries(cli_test ${CMAKE_CURRENT_SOURCE_DIR}/rtaudio/lib/librtaudio.a ${LINKLIBS})
target_link_libraries(cli_test PRIVATE Threads::Threads)
target_link_libraries(cli_test PRIVATE jack)
target_link_libraries(cli_test PRIVATE /usr/lib/libasound.so)
target_link_libraries(cli_test PRIVATE /usr/lib/libpulse.so)
target_link_libraries(cli_test PRIVATE /usr/lib/libpulse-simple.so)
(which again, works just fine). Then I got this one for qwt_test.pro:
CONFIG += c++1z c++14
INCLUDEPATH += .
INCLUDEPATH += $${PWD}/rtaudio/include/rtaudio
LIBS += $${PWD}/fftw/lib/libfftw3.a
LIBS += $${PWD}/rtaudio/lib/librtaudio.a
LIBS += jack
LIBS += /usr/lib/libasound.so
LIBS += /usr/lib/libpulse.so
LIBS += /usr/lib/libpulse-simple.so
TARGET = qwt_test
SOURCES = \
main.cpp
The error that I get is:
linking ../bin/qwt_test
/usr/bin/ld: cannot find jack: No such file or directory
collect2: error: ld returned 1 exit status
My question is, how can I link my project that is using qmake with jack?
To let qmake know where to find the lib please add
LIBS += -L"where-you-have-jack-lib" -ljack

C++ CMAKE Predicate no such file

First of all, the error log:
-- Boost version: 1.59.0
-- Success!
-- Could NOT find Freetype (missing: FREETYPE_LIBRARY) (found version "2.6.3")
-- LOADING OS --Windows--
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Gianluca/.CLion2016.2/system/cmake/generated/mcdu-57fe38f9/57fe38f9/Debug
[ 1%] Automatic moc for target untitled
[ 1%] Built target untitled_automoc
[ 2%] Building CXX object CMakeFiles/untitled.dir/main.cpp.obj
[ 3%] Building CXX object CMakeFiles/untitled.dir/mainwindow.cpp.obj
[ 4%] Building CXX object CMakeFiles/untitled.dir/gldisplay.cpp.obj
[ 7%] Building CXX object CMakeFiles/untitled.dir/svg/svg.cpp.obj
[ 7%] Building CXX object CMakeFiles/untitled.dir/svg/svgfont.cpp.obj
[ 8%] Building CXX object CMakeFiles/untitled.dir/svg/svgstring.cpp.obj
[ 11%] Building CXX object CMakeFiles/untitled.dir/ht1000scriptmanager.cpp.obj
[ 11%] Building CXX object CMakeFiles/untitled.dir/ht1000widgetfactory.cpp.obj
CMakeFiles\untitled.dir\build.make:149: recipe for target 'CMakeFiles/untitled.dir/svg/svg.cpp.obj' failed
In file included from C:\Work\PolitecProductions\mcdu\svg\svg.cpp:1:0:
C:\Work\PolitecProductions\mcdu\svg\svg.h:14:48: fatal error: boost/algorithm/string/predicate.hpp: No such file or directory
#include <boost/algorithm/string/predicate.hpp>
^
compilation terminated.
In file included from C:\Work\PolitecProductions\mcdu\svg\svgstring.cpp:3:0:
C:\Work\PolitecProductions\mcdu\svg\./svg.h:14:48: fatal error: boost/algorithm/string/predicate.hpp: No such file or directory
#include <boost/algorithm/string/predicate.hpp>
^
compilation terminated.
mingw32-make.exe[2]: *** [CMakeFiles/untitled.dir/svg/svg.cpp.obj] Error 1
mingw32-make.exe[2]: *** Waiting for unfinished jobs....
In file included from C:\Work\PolitecProductions\mcdu\svg\svgfont.cpp:2:0:
C:\Work\PolitecProductions\mcdu\svg\./svg.h:14:48: fatal error: boost/algorithm/string/predicate.hpp: No such file or directory
#include <boost/algorithm/string/predicate.hpp>
^
compilation terminated.
CMakeFiles\untitled.dir\build.make:199: recipe for target 'CMakeFiles/untitled.dir/svg/svgstring.cpp.obj' failed
mingw32-make.exe[2]: *** [CMakeFiles/untitled.dir/svg/svgstring.cpp.obj] Error 1
CMakeFiles\untitled.dir\build.make:174: recipe for target 'CMakeFiles/untitled.dir/svg/svgfont.cpp.obj' failed
mingw32-make.exe[2]: *** [CMakeFiles/untitled.dir/svg/svgfont.cpp.obj] Error 1
CMakeFiles\untitled.dir\build.make:249: recipe for target 'CMakeFiles/untitled.dir/ht1000widgetfactory.cpp.obj' failed
In file included from C:\Work\PolitecProductions\mcdu\ht1000widgetfactory.cpp:1:0:
C:\Work\PolitecProductions\mcdu\./ht1000widgetfactory.h:5:25: fatal error: QScriptEngine: No such file or directory
#include <QScriptEngine>
^
compilation terminated.
more http://pastebin.com/72ySYdVd
This is my actual CMakeLists
cmake_minimum_required(VERSION 3.6)
project(mcdu)
#### Boost Check Version
find_package(Boost REQUIRED)
if(Boost_FOUND)
message(STATUS "Success!")
endif()
#### Qt5
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Script REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(FREETYPE)
set(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::OpenGL Qt5::Core Qt5::Script)
set( CMAKE_AUTOMOC ON )
ADD_DEFINITIONS(${QT_DEFINITIONS})
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage ")
add_definitions("-std=c++11")
# Find includes in corresponding build directories
include_directories(
${BOOST}
${FREETYPE}
${Qt5Widgets_INCLUDE_DIRS}
-lopengl32 -lglu32 -luser32
)
if (WIN32)
message(STATUS "LOADING OS --Windows--")
include_directories(
${BOOST}/lib32-msvc-14.0 -libboost_timer-vc140-mt-gd-1_59 -libboost_log-vc140-mt-gd-1_59 -libboost_log_setup-vc140-mt-gd-1_59
${FREETYPE}/objs/vc2010/Win32/ -lfreetype263d
)
endif ()
#Source Files
set(SOURCE_FILES
src files. Cut to be short
#Header Files
set(HEADER_FILES
header files. Cut to be short
)
#Add Forms
QT5_WRAP_UI(FORM_FILES
.ui files
)
add_executable(untitled ${SOURCE_FILES} ${HEADER_FILES} ${FORM_FILES})
more http://pastebin.com/uGf3SHUn
So under svg.h the include is as it follows:
#include <boost/algorithm/string/predicate.hpp>
I've MSVC2015 and BOOST + FREETYPE env. variables are added to the system AND Clion. If I build that from QT I only get predicate.hpp error.
Here is the QT PRO file
QT += core gui script opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = mcdu
TEMPLATE = app
DEFINES += WIN
DEFINES += OGLFT_NO_SOLID
DEFINES += OGLFT_NO_QT
DEFINES += TEST
INCLUDEPATH += $$(BOOST)
INCLUDEPATH += $$(FREETYPE)/include
INCLUDEPATH += status
INCLUDEPATH += systems
INCLUDEPATH += svg
INCLUDEPATH += displays
CONFIG += debug
win32 {
DEFINES += WINDOWS
LIBS += -lopengl32 -lglu32 -luser32
LIBS += -L$$(BOOST)/lib32-msvc-14.0 -libboost_timer-vc140-mt-gd-1_59 -libboost_log-vc140-mt-gd-1_59 -libboost_log_setup-vc140-mt-gd-1_59
LIBS += -L$$(FREETYPE)/objs/vc2010/Win32/ -lfreetype263d
}
linux {
message("Build for Linux")
DEFINES += LINUX
DEFINES += BOOST_LOG_DYN_LINK
LIBS += -lGLU
LIBS += -lfreetype
LIBS += -L/home/RINF/rogosz/source/boost_1_59_0/stage/lib -lboost_timer -lboost_log -lboost_log_setup -lboost_system -lboost_thread -lboost_filesystem
}
SOURCES += src files: cut to be short
HEADERS += header files. cut to be short
FORMS += form files. cut to be short
find_package(Boost REQUIRED)
# ...
# Find includes in corresponding build directories
include_directories(
${BOOST}
${FREETYPE}
${Qt5Widgets_INCLUDE_DIRS}
-lopengl32 -lglu32 -luser32
)
The variable set by the find_package( Boost ... ), containing the path to the Boost header files, is named Boost_INCLUDE_DIRS, not BOOST.
And unless FREETYPE is breaking the pattern, that should be FREETYPE_INCLUDE_DIRS as well.
And what are the linker directives (-lopengl32 -lglu32 -luser32) doing in there?
if (WIN32)
message(STATUS "LOADING OS --Windows--")
include_directories(
${BOOST}/lib32-msvc-14.0 -libboost_timer-vc140-mt-gd-1_59 -libboost_log-vc140-mt-gd-1_59 -libboost_log_setup-vc140-mt-gd-1_59
${FREETYPE}/objs/vc2010/Win32/ -lfreetype263d
)
endif ()
I am quite confused. What is this even meant to achieve? You use the command include_directories(), but it looks as if you are trying to give linker instructions here? Adding link dependencies is done via target_link_libraries()...
And even if you would be using the correct command, you would not give linker instructions (-lfreetype263d), but list link targets, preferably those provided by the various find_package() calls, i.e. ${Boost_LIBRARIES} (not ${BOOST}), and ${FREETYPE_LIBRARIES} (not ${FREETYPE}).
Further:
set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_RELEASE} -fprofile-arcs -ftest-coverage ")
add_definitions("-std=c++11")
These are compiler-specific options that won't float your boat if you are working with Visual Studio. Use if ( MSVC ) and if ( CMAKE_COMPILER_IS_GNUCC ) to check what compiler you are working with.

how do i create a custom (widget) plugin for qt designer with cmake ( and visual studio )

The amount of tutorials, how to create a qt designer plugin is very thin..and the ones i found always use qt creator ( like this one : http://qt-project.org/doc/qt-4.8/designer-customwidgetplugin.html ). Where i have to add some qt definitions in the .pro file
CONFIG += designer plugin
I use CMake and Visual Studio for coding, so it would be really awesome if someone could tell me how i successfully create a .dll that i can put in the plugins/designer folder to have the custom widget show up in Qt Designer
Disclaimer: I know this is an old question but Even now I didn't find complete resources on how to do it.
I can't answer you for the Visual Studio part since I build on the (windows) command line, but here is my cmake.
I assume you have already created the following files related to the plugin, i.e.:
widget.h
widget.cpp
widget.ui
widgetPlugin.h -> QDesignerCustomWidgetInterface class
widgetPlugin.cpp
And that you want to create a library with multiple plugins, i.e. created the related files:
plugins.h -> QDesignerCustomWidgetCollectionInterface class
plugins.cpp
The content of the files simply follow what's in the tutorials.
The CMakeLists.txt is:
cmake_minimum_required(VERSION 2.8)
set(PROJECT Plugins)
project(${PROJECT})
# Needed to compile against ui and moc generated files
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set(SOURCES
plugins.cpp
widgetPlugin.cpp
widget.cpp
)
set(HEADERS
plugins.h
widgetPlugin.h
widget.h
)
set(FORMS
widget.ui
)
# This is experimental, it works but it may be not optimal, don't hesitate to change this
find_package(Qt4 REQUIRED QtCore QtGui QtDesigner)
if (QT4_FOUND AND QT_QTCORE_FOUND AND QT_QTGUI_FOUND AND QT_QTDESIGNER_FOUND)
set(QT_USE_QTDESIGNER TRUE)
include(${QT_USE_FILE})
else()
message(FATAL_ERROR "no qt...")
endif()
qt4_wrap_cpp(HEADERS_MOC ${HEADERS})
qt4_wrap_ui(FORMS_HEADERS ${FORMS})
qt4_add_resources(RESOURCES_RCC ${RESOURCES})
# Here too, I'm not sure every define is necessary
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(-DQT_PLUGIN)
add_definitions(-DQT_NO_DEBUG)
add_definitions(-DQT_SHARED)
add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
add_library(${PROJECT} SHARED
${SOURCES}
${HEADERS_MOC}
${FORMS_HEADERS}
${RESOURCES_RCC}
)
target_link_libraries(${PROJECT} ${QT_LIBRARIES})
# Install the library in QtDesigner plugin directory
install(TARGETS ${PROJECT}
DESTINATION ${QT_PLUGINS_DIR}/designer
)
To reload the plugins in QtDesigner, go to Help > About Plugins > Reload.
Then in the other CMakeLists.txt, I didn't want to include the library since there are also useless *Plugin files. So I included again the files I wanted :
cmake_minimum_required(VERSION 2.8)
set(PROJECT GPAUSX)
project(${PROJECT})
# Include the other CMakeLists.txt
subdirs(Plugins)
find_package(Qt4 REQUIRED)
# Files to insert
set(SOURCES
main.cpp
MainWindow.cpp
${Plugins_SOURCE_DIR}/widget.cpp
)
set(HEADERS
MainWindow.h
${Plugins_SOURCE_DIR}/widget.h
)
set(FORMS
MainWindow.ui
${Plugins_SOURCE_DIR}/widget.ui
)
qt4_wrap_cpp(HEADERS_MOC ${HEADERS})
qt4_wrap_ui(FORMS_HEADERS ${FORMS})
qt4_add_resources(RESOURCES_RCC ${RESOURCES})
include(${QT_USE_FILE})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_definitions(${QT_DEFINITIONS})
# I'm no expert in libraries so, intuitively I'd say this is useless but it won't compile if I don't define it.
# This clearly needs to get fixed.
add_definitions(-DQDESIGNER_EXPORT_WIDGETS)
# Possible variants making it compile :
# 1/ either include Plugins_BINARY_DIR or include .uis
# including the binary dir makes use of the already generated .uis
# 2/ either target Plugins or add Plugins .uis, .hs and .cpps with -DQDESIGNER_EXPORT_WIDGETS
# if you target plugins, make sure you compile with the same flags
add_executable(${PROJECT}
${SOURCES}
${HEADERS_MOC}
${FORMS_HEADERS}
${RESOURCES_RCC}
)
target_link_libraries(${PROJECT}
# Uncomment the following if you want to target Plugins
#Plugins
${QT_LIBRARIES}
)
Hope you'll find it useful !
Just use the cmake's qt auto tools and add all sources(.cpp .ui .qrc etc) to the target as follow:
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt4 REQUIRED QtCore QtGui QtDesigner #...
)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
add_library(someplugin SHARED
path/to/plugin/someplugin.cpp
path/to/plugin/someplugin.qrc
path/to/plugin/someplugin.ui
path/to/plugin/s/other/src.cpp
#...
)
target_link_libraries(someplugin ${QT_LIBRARIES})
install(TARGETS someplugin
DESTINATION ${QT_PLUGINS_DIR}/designer
)

Linking QtCreator && OpenCv

I'm having a problem linking a library from opencv(2.3.1) and can't find a way to resolve it..
I'm using qtCreator with mingw and the pre-built vc10 dynamic lib files.
So, here is what I have done till now:
.pro file:
TEMPLATE = app
INCLUDEPATH += "E:/opencv/build/include/"
INCLUDEPATH += "E:/opencv/build/include/opencv/"
INCLUDEPATH += "E:/opencv/build/include/opencv2/"
INCLUDEPATH += $$PWD/../opencv/build/x86/vc10
DEPENDPATH += $$PWD/../opencv/build/x86/vc10
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_core231
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_core231d
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_highgui231
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_highgui231d
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_imgproc231
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_imgproc231d
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_calib3d231
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../opencv/build/x86/vc10/lib/ -lopencv_calib3d231d
...
I have tested an application that used highgui libs from opencv and it compiled and worked nicely, but when I try to use cvPyrDown(from imgproc_c.h) it compiles but can't load the library correctly it "exits unexpectedly" with code -1073741515.
I don't understand why that is.. as you can see from the .pro file I linked the imgproc libs just like the highgui, but it still won't work!
Any suggestions ?
Edit
Ok, the problem is that visual studio creates libraries with different naming conventions than g++ and that's why it won't work.. If this is true, I still can't explain why it works with the highgui libs.. Any ideas ?
Shouldn't you be using the MSVC version of Qt then?
Which version of Opencv is this? I suggest trying latest 2.3, and using CMake instead of .pro files, which is the build system for the overall project.
Then you just file->open-project on the CMakeLists.txt, and you can just look at how examples are set up with CMake.
If this is latest, then 1) highgui uses QT so it makes sense that it might play nicer with qt creator and 2) building with .pro on windows might be untested; a unavoidable need for CMake would not be surprising.
Edit: Look at the CMakeLists.txt files for the libraries ....
# CMakeLists.txt for /modules/highgui
#YV
if (HAVE_QT)
if (HAVE_QT_OPENGL)
set(QT_USE_QTOPENGL TRUE)
endif()
INCLUDE(${QT_USE_FILE})
SET(_RCCS_FILES src/window_QT.qrc)
QT4_ADD_RESOURCES(_RCC_OUTFILES ${_RCCS_FILES})
SET(_MOC_HEADERS src/window_QT.h )
QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS})
set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY})
set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} )
endif()
if(WIN32)
if(NOT HAVE_QT)
set(highgui_srcs ${highgui_srcs} src/window_w32.cpp)
endif()
set(highgui_srcs ${highgui_srcs} src/cap_vfw.cpp src/cap_cmu.cpp src/cap_dshow.cpp)
if(HAVE_MIL)
set(highgui_srcs ${highgui_srcs} src/cap_mil.cpp)
endif()
endif()
if(UNIX)
if(NOT HAVE_QT)
if(HAVE_GTK)
set(highgui_srcs ${highgui_srcs} src/window_gtk.cpp)
endif()
endif()
....
endif()
But "imgproc"'s CMakeLists.txt doesn't do any specific checks ... just passes the buck to main opencv lib:
define_opencv_module(imgproc opencv_core)