PDA

View Full Version : undefined reference for dcmtk libraries



karatystas
19th February 2016, 12:07
I'm trying to link dcmtk libraries for developing application for DICOM images. However, I cannot link those external libraries - I get the error message:


C:\Users\Donn\Documents\untitled1\main.cpp:10: 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

#--------------------------------
CONFIG += c++11
#--------------------------------
INCLUDEPATH += C:/DCMTK/include

LIBS += -L"C:/DCMTK/lib" -lAdvAPI32 -ldcmimgle -ldcmdata -loflog -lofstd -lWS2_32 -lNetAPI32 -lWSock32

#----------------------------------



How to fix this problem? I even tried to delete the LIBS line and still I get the same effect. Looks like those libraries are not linked at all.

darsanapm
29th May 2018, 13:14
I am too facing the same problem. Can somebody suggest a method to solve the error:
The error is:
error: undefined reference to `DicomImage::DicomImage(char const*, unsigned long, unsigned long, unsigned long)'