How to link DCMTK with Qt on Mac OSX - c++

I am new with all of these Qt, Dcmtk and CMake and I am suppose to use it for a school project. A lot of things are available on the internet but essentially for Windows..
I am trying to link Dcmtk with Qt and make it run on my mac but It is not working, the error is:
Error output
I have already built dcmtk with CMake (note the CMake wasn't generating the right paths...)
I know this error seems recurrent and I should add a LIB += ...
But I tried a lot of different one and I couldn't find anything that solve my problem according to linking dcmtk
Here is my current code according to some found online:
.pro file
main.cpp
I am feeling a bit powerless right now if someone could enlighten me.
Thank you!

Did you forget to link with dcmimage?
try adding LIBS += -ldcmimage

Related

CMake Error: The source directory "C:/Program Files (x86)/Geant4/geant4_10_02-build" does not appear to contain CMakeLists.txt

this is my first time using this and very new in C++. I'm trying to install Geant4 developed by CERN...but i think the main problem that I'm having here is CMake ...does anyone know how i can fix this? I have already tried to fix this by searching on the internet this error message but most of the solutions are for Linux or Mac and I'm using Windows. Honestly I just don't understand where the problem might be.
Thanks in advance

QArrayData error, linking Qt libraries with CMake

What I've been trying to do is to link Qt libraries to my project with CMake. I would use CMake GUI to generate MakeFile and then run MinGW32-make on it, which would give me '[File Name].exe' as intended. However, whenever I run the executable file, I get a message saying:
"The procedure entry point _ZN10QArrayData10deallocateEPS_jj could not be located in the dynamic link library etc."
https://i.stack.imgur.com/JpdwK.jpg
I initially built this software using Qt Creator and QMake, so I can confirm that the program has been tested and does work, but as I have to include an API, it requires me to use CMake instead.
I have done a lot of research and experimenting mostly with the CMakeLists.txt, but unfortunately, I'm not that good at it and I kinda suspect that's where the problem lies.

Qwt version conflict QTCREATOR

I'm having trouble deploying .exe generated with QtCreator on Ubuntu 14.04. I got several versions of qwt installed (and i need those, one compiled with qt4 the other with qt5).
Problem is, i don't know why but Qt seems to link the wrong version of qwt to my .exe whatever i do .. When i use LDD on my .exe, it always show /usr/lib/libqwt.so.6. Thing is i'm linking the version i need in my .pro like this :
LIBS += -L/usr/local/qwt-6.1.2/lib/ -lqwt
And in project configuration i set LD_LIBRARY_PATH with /usr/local/qwt-6.1.2/lib
Still my .exe doesn't link to the right library.
Any idea why and how to fix this ? It causes segmentation fault on launch of course as my program is compiled with qt5 and not qt4..
Thanks in advance
You can try adding a runtime path to the linker flags. In your .pro file you can add the following line (Its probably worth printing your QMAKE_LFLAGS in your pro file as well):
QMAKE_LFLAGS += "-Wl,-rpath,/usr/local/qwt-6.1.2/lib/"
message ("QMAKE_LFLAGS = $$QMAKE_LFLAGS")
Re-compile and then run ldd again. During runtime also ldd) your program should now point to this location first.
Note
This is assuming that you are using a gnu compiler!
I sorted out my problem, seems like settings the environment variables in QtCreator is not enough. You have to do it in the terminal aswell before launching the .exe, that was my bad.
Just had to set LD_LIBRARY_PATH correctly.

how to view a 3D pcd in Qt on Ubunto with PCL library?

I am starting to use PCL library in my project , which is in Qt in Ubuntu.
I have a PCD file and i want to see it.
all the answers I have seen so far are about using visualization library
#include <pcl/visualization/cloud_viewer.h>
which gives me error in my project and according to other discussions this usage is not ment for Qt.
any help on how could i view my pcd file?
thanx
Edit your ".pro" file. This is how I attach Irrlicht to my Qt projects which may have something similar to what you're after. By adding the references for the include directory and the libs directly.
Hope this helps.
win32:INCLUDEPATH += C:\irrlicht-1.8\include
win32:LIBS += c:\irrlicht-1.8\lib\win32-gcc\libirrlicht.a
I found the cause!
it was because I did not have installed the visualization library!
the problem was that I had not checked the output of compiling the PCL library and it had said that it would not compile some modules because of dependency problems.

How to Link Imagemagick library to Qt(windows)

I have developed an application with mac and for one month now, Im trying to link Qt with ImageMagick on windows.
I just cant find the files and the version of Imagemagick library that need to be linked to Qt in order to make my application work on windows.
I have tried most of the libraries from here
Thats the only thing I added to the .pro file while I was developing on a mac
INCLUDEPATH += . /opt/local/include/ImageMagick
LIBS += -L/opt/local/lib -lMagick++
When I add this to my .pro
INCLUDEPATH += C:/im6/include/ImageMagick
LIBS += C:/im6/lib/libMagickWand.a
LIBS += C:/im6/lib/libMagick++.a
LIBS += C:/im6/lib/libMagickCore.a
C:/im6/lib/libMagick++.a
I get 10.000 + simmilar errors to that:
(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4157: undefined reference to `__gxx_personality_sj0'
C:/im6/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4157: undefined reference to `_Unwind_SjLj_Register'
C:/im6/lib/libMagick++.a(Image.o):C:\msys\1.0\home\cristy\ImageMagick-6.6.6-0/Magick++/lib/Image.cpp:4178: undefined reference to `_Unwind_SjLj_Unregister'
For more errors check this
Has anyone tried to build and deploy an ImageMagick application using qt on windows ?
Which files do I need to link while building and which files while deploying ?
The error message tells me that you
use mingw (with qtcreator). Your
library might not work with this
compiler. You need a mingw version
of the library, probably named
libmagick.a.
LIBS += -L$$quote(c:/Program Files/ImageMagick-6.6.5-Q16/lib) -lmagick
(see the documentation about qmake Project Files
I have found that the minGW tool set is very much treated as a "stepchild" in the Windows world. I know it doesn't help your particular situation, but we had numerous problems with third-party libs while trying to use Qt with minGW. There were always extra steps, or non-existent build instructions that we had to figure out or tweak.
Once we switched to the MSVC version, all of those problems went away. Note that this doesn't mean you have to use Visual Studio (you can still use Qt creator), it just means that the Visual Studio compiler is being used. You can get the compiler for free using the Platform SDK. If this is an option, you might save yourself a lot of pain by switching now. It's unfortunate, but that is just the current status quo, at least as we discovered.
Please go get ImageMagick source package.
I can’t give direct instructions how to work with MinGW of Qt Creator, but basically following. I prefer to use qtvars.bat that comes with binary distributions of Qt to set environment.
Open Windows cmd
Set PATH to have /path/to/mingw/bin and /path/to/qt/bin before other paths
Go to directory where you have extracted ImageMagick source
read README, INSTALL and such to compile the ImageMagick (most likely just ./configure ; mingw32-make, but never be sure)
Edit your .pro file with something like LIBS += -L$$quote(/path/to/imagemagick/lib/dir) -lmagick . The lib may be in bin dir or in lib dir. See hmuelner’s answer for more information.
At this point, the configuration should be ready. Compilation at Qt Creator should work, but you can as well use this cmd windows to compile your program: go to program directory, run “qmake” and “mingw32-make”.
You cannot link against a ImageMagick++ library built with MSVC, as mingw and MSVC DLLs are incompatible for C++ libraries. You can't link a MSVC-built C++ library into a mingw project, nor vice versa. C-only libraries work fine. Also, according to this fortum thread, using builds against old mingw-versions with current mingw versions doesn't work as the exception handling changed (as you get more errors than that, I wouldn't expect that to be the only problem though). If there is no binary package for your mingw version (and I don't see any on the imagemagick website), your only option is to use a source package, as Smar suggests.
Another option of course is to install Visual Studio, download Qt for MSVC and build your project with MSVC.