I'm very new to QTCreator. I made a small program using Dcmtk libraries in Visual studio, now I'm trying to make that with GUI and for doing so I'm trying to make the same program in QTCreator so that I can add that GUI feature. But the problem occurs when I try to add the header files and .lib files to QTCreator. When doing the program in Visual studio I added the following libraries libraries:
dcmdata.lib
oflog.lib
ofstd.lib
ws2_32.lib
netapi32.lib
with the library directory for debug mode:
D:\dcmtk-3.6.0\Lib files\Debug;
and for release mode was
D:\dcmtk-3.6.0\Lib files\Release;
For adding the header files in Visual Studio I put the include directories as:
D:\dcmtk-3.6.0\Prefix Files\include;
So, for QTCreator in the .pro file I edited and added the lib files and header file directories and pointed which lib files I need and the .pro file looked as the following:
#-------------------------------------------------
#
# Project created by QtCreator 2013-05-02T10:59:41
#
#-------------------------------------------------
QT += core#adding the core framework
QT -= gui#removing the gui portion
TARGET = untitled#targetting the project
CONFIG += console#defining that it is console application
CONFIG -= app_bundle#
TEMPLATE = app
SOURCES += main.cpp#adding the main.cpp as source file
LIBS +="D:/dcmtk-3.6.0/Lib files/Release"
-ldcmdata\
-loflog\
-lofstd\
-lws2_32\
-lnetapi32\
-wsock32\
LIBS +="D:/dcmtk-3.6.0/Lib files/Debug"
-ldcmdata\
-loflog\
-lofstd\
-lws2_32\
-lnetapi32\
-lwsock32\
INCLUDEPATH += "D:/dcmtk-3.6.0/Prefix Files/include"
I haven't begun programming yet, but I just added the names of header files using #include directive and the code is the following:
#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();
}
But this gives error when I try to build it. The error is the following:
D:\QtFiles\untitled\main.cpp:3: error: C1083: Cannot open include file: '/dcmtk/config/osconfig.h': No such file or directory
It seems I made some error while linking the header files and lib files to the program. The two lines in the programming code
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"
doesn't give error in Visual Studio, so I'm sure there's nothing wrong with them. Could you say me what mistake I'm doing in linking the external header and lib files?
SOLUTION:
I changed the lines in .pro file that links the external to the following and it worked:
LIBS += -L"D:/dcmtk-3.6.0/Lib files/Release" \
-ldcmdata\
-loflog\
-lofstd\
-lws2_32\
-lnetapi32\
-lwsock32\
LIBS += -L"D:/dcmtk-3.6.0/Lib files/Debug" \
-ldcmdata\
-loflog\
-lofstd\
-lws2_32\
-lnetapi32\
-lwsock32\
INCLUDEPATH += "D:/dcmtk-3.6.0/Prefix Files/include/"