1

I am trying to get DCMTK working in Qt Creator, but I got stuck at step 5. Please let me know if the other steps are wrong.

Tools:

Qt Creator: Qt Creator 3.5.1 (opensource), based on Qt 5.5.1 (MSVC 2013, 32 bit)

Visual Studio: Microsoft Visual Studio Ultimate 2013, version 12.0.40629.00 Update 5

DCMTK: v3.6.0

CMake: v3.3.2

What I did:

  1. I generated the project files using CMake

enter image description here

  1. I opened C:\dcmtk-bin\DCMTK.sln in Visual Studio and built ALL_BUILD

enter image description here

  1. I restarted Visual Studio in admin mode, opened C:\dcmtk-bin\DCMTK.sln and built INSTALL

enter image description here

  1. I started Qt Creator and created a new Qt Console Application

  2. What do I need to add to the .pro file in order to get my project working? I have tried to add code from related questions like this AND this but I can't get rid of errors like

Cannot open include file: 'dcmtk/config/osconfig.h': No such file or directory

OR

LNK1104: cannot open file 'dcmdata.lib'

My main.cpp file contains the following code:

#include <QCoreApplication>
#include <QDebug>
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    QString mystr="Hellow world";
    qDebug() <<mystr;
    return a.exec();
}
Community
  • 1
  • 1
Engo
  • 899
  • 3
  • 19
  • 49
  • 1
    In the properties for the new Qt Console Application project, did you set the path in `C/C++ | General | Additional Include Directories`? Similar thing for libs, `Linker | General | Additional Library Directories`. – Chris O Nov 10 '15 at 23:09
  • Agree with Engo. To simplify it, you can find the libs yourself and copy them to a local folder. If not they should look something like this; LIBS +="D:/dcmtk-3.6.0/Lib files/Release" where the drive and path match your own dev system. The same goes for the include paths. – john elemans Nov 11 '15 at 00:19

1 Answers1

1

To use DCMTK in Qt Creator you should add to your project *.pro file information about where DCMTK include files reside, where binaries reside and where linking file resides. So the simplest way is to create corresponding *.pri file and include it to your project file:

DCMTK.pri (default build path for DCMTK library)

DCMTK_PATH = "C:/Program Files (x86)/DCMTK"

INCLUDEPATH += $${DCMTK_PATH}/include
LIBS += -L$${DCMTK_PATH}/bin \
        -L$${DCMTK_PATH}/lib

LIBS += -ldcmtk

Myproject.pro

...

include(DCMTK.pri)
Alex
  • 98
  • 7