error calling dcmtk from another project

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
pdeman
Posts: 4
Joined: Wed, 2019-05-22, 18:40

error calling dcmtk from another project

#1 Post by pdeman »

Hi,

i have compiling dcmtk from git on windows server 2019 using visual studio 2017 and performed "INSTALL".
In my project, I want to call dcmtk function so I added:
the folder include in "additional include directory"
and the folder lib in the linker ("additional libraries directory") using visual studio.

I put:

Code: Select all

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dcfilefo.h"
#include "dcmtk/dcmdata/dcdict.h"
in my code and I got this error:

Severity Code Description Project File Line Suppression State
Error C2678 binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion) Clocks.native g:\contracts\installdcmtkcpp11\include\dcmtk\oflog\tracelog.h 59
Severity Code Description Project File Line Suppression State
Error C2664 'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *' Clocks.native g:\contracts\installdcmtkcpp11\include\dcmtk\oflog\tracelog.h 59
Severity Code Description Project File Line Suppression State
Error C2678 binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion) Clocks.native g:\contracts\installdcmtkcpp11\include\dcmtk\oflog\tracelog.h 64
Severity Code Description Project File Line Suppression State
Error C2664 'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *' Clocks.native g:\contracts\installdcmtkcpp11\include\dcmtk\oflog\tracelog.h 64
Severity Code Description Project File Line Suppression State
Error C2665 'dcmtk::log4cplus::Logger::getInstance': none of the 2 overloads could convert all the argument types Clocks.native g:\contracts\installdcmtkcpp11\include\dcmtk\oflog\logmacro.h 106

what did I do wrong ?
Last edited by pdeman on Wed, 2019-06-05, 15:52, edited 1 time in total.

pdeman
Posts: 4
Joined: Wed, 2019-05-22, 18:40

Re: error calling dcmtk from another project

#2 Post by pdeman »

moreover if I want to link the .dll instead of the .lib I get this error:
Severity Code Description Project File Line Suppression State
Error LNK1107 invalid or corrupt file: cannot read at 0x300 Clocks.native G:\InstallDCMTKCpp11\bin\dcmnet.dll 1

if I link the .lib only. I can compile but when I try to run, it still looking for the .dll. If I don't add it in the linker I ave a dcmdata.dll was not found error message.
If I add dcmdata.dll to the additional dependencies, I have the invalid or corrupt file error.

If I doesn't generate the shared libraries, only the static ones, I have this error:
Severity Code Description Project File Line Suppression State
Error C1189 #error: "Mixing a dll boost library with a static runtime is a really bad idea..." Clocks.native


I can't find a way to use dcmtk function in my project

J. Riesmeier
DCMTK Developer
Posts: 2496
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: error calling dcmtk from another project

#3 Post by J. Riesmeier »

what did I do wrong ?
My first guess would be that you compiled your project and, therefore, also the included DCMTK header files with UNICODE or _UNICODE defined. This is not supported as you can read in the INSTALL file:

Code: Select all

Known limitations of DCMTK on the Windows platform.
[...]
3. DCMTK does not compile when UNICODE or _UNICODE is defined because the
   VisualStudio compiler then uses the Unicode version instead of the ANSI
   version for all Windows API functions (i.e. type wchar_t instead of char
   for all character string parameters and return values).

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest