0

I'm trying to run a simple application in Qt creator using DCMTK libraries and it doesn't work as it should. I receive the following message:

error: undefined reference to `DicomImage::DicomImage(char const*, unsigned long, unsigned long, unsigned long)'

main.cpp:

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"
#include "dcmtk/dcmimgle/dcmimage.h"
#include "iostream"

int main(int argc, char *argv[])
{

    DicomImage *image = new DicomImage("test.dcm");
    if (image != NULL){
        std::cout << "hell yeah!";
    }

    return 0;
}

.pro file:

#-------------------------------------------------
#
# Project created by QtCreator 2016-02-18T19:16:51
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = untitled1
TEMPLATE = app


SOURCES += main.cpp\
        mainwindow.cpp

HEADERS  += mainwindow.h

FORMS    += mainwindow.ui

#------------------
CONFIG += c++11

INCLUDEPATH += "C:\Program Files (x86)\DCMTK_1\include"
LIBS += -L"C:\Program Files (x86)\DCMTK_1\lib"
LIBS +=-ldcmimgle -ldcmdata -loflog -lofstd

win32:LIBS += -lAdvapi32 -lofstd -loflog -ldcmdata -ldcmnet -ldcmimage -ldcmimgle -lws2_32 -lnetapi32 -lwsock32

I think something is wrong with .pro file but I cannot figure out. I have included the necessary libraries and still no use.. I read that for DCMTK the order of libraries is important but I think it is already in order and cannot figure out what could be. Can you provide a solution to this problem?

Donatas
  • 443
  • 3
  • 6
  • 11
  • You put all the libraries in the one folder? – john elemans Feb 19 '16 at 00:01
  • Yes, those **dcmimgle dcmdata oflog ofstd ldcmimage dcmnet** are in one folder, however, I have noticed that **Advapi32 lws2_32 netapi32 wsock32** are not in the same folder with previous libraries and it belongs to Microsof SDK. I have included it too but still doesn't work. – Donatas Feb 19 '16 at 06:57
  • It looks correct. I'll try to set up the test app here to see. In the mean time, what I always do in this situation is run qmake. :) – john elemans Feb 19 '16 at 17:02
  • Does it work you? I was able to execute it in Visual Studio 2013, but I needed to change my testapp Runtime Library option from Multi-threaded Debug DLL (/MDd) to Multi-threaded Debug (/MTd) in Property Pages. Perhaps something similar is with Qt creator. I tried to add flags as described here http://stackoverflow.com/questions/16688079/how-to-change-the-c-runtime-library-setting-in-qtcreator/35522716#35522716 but still no use... Any suggestions? – Donatas Feb 20 '16 at 11:58

0 Answers0