Error during build solution : VS 2015 + DCMTK 3.2.6

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Error during build solution : VS 2015 + DCMTK 3.2.6

#1 Post by MED_G »

Hello everyone,

After successfully compile and install DCMTK, some error appeared, most of them are related to setup path of DCMTK.
But, some others still persist.

My environment :
- Microsoft Visual studio community 2015 / version 14.0.25123.00 Update2
- Windows 7 Professional 64 bits
- Qt 5.6.3
- dcmtk-3.6.2
- Cmake-3.9.4-win64-x64
- dcmtk-3.6.2-win64-support_MD-msvc-14.0

Those some screenshot of compile and installation steps :


build
https://prntscr.com/hc2j6u

http://prntscr.com/hc2on8

http://prntscr.com/hc2pj3

installation
http://prntscr.com/hc2pqm

Now, I include DCMTK to my project, on visual studio. ( in the begin it was a problem with include c:\DCMTK to "include directories " setting, it was fixed later.

http://prntscr.com/hc2qyz

Now, clean and rebuild my project, some error still appeared, but this time, are related to instruction in header files :

Code: Select all

Severity	Code	Description	File	Line	Suppression State
Error (active)		expected an identifier	c:\DCMTK\include\dcmtk\ofstd\oflimits.h	72	
Error (active)		no instance of overloaded function "dcmtk::log4cplus::Logger::getInstance" matches the argument list	c:\DCMTK\include\dcmtk\oflog\logmacro.h	106	
Error (active)		no operator "+" matches these operands	c:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error (active)		no operator "+" matches these operands	c:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error (active)		expected an identifier	c:\DCMTK\include\dcmtk\ofstd\oflimits.h	78	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2665	'dcmtk::log4cplus::Logger::getInstance': none of the 2 overloads could convert all the argument types	C:\DCMTK\include\dcmtk\oflog\logmacro.h	106	
Error	C2589	'(': illegal token on right side of '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	72	
Error	C2059	syntax error: '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	72	
Error	C2589	'(': illegal token on right side of '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	78	
Error	C2059	syntax error: '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	78	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2665	'dcmtk::log4cplus::Logger::getInstance': none of the 2 overloads could convert all the argument types	C:\DCMTK\include\dcmtk\oflog\logmacro.h	106	
Error	C2589	'(': illegal token on right side of '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	72	
Error	C2059	syntax error: '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	72	
Error	C2589	'(': illegal token on right side of '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	78	
Error	C2059	syntax error: '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	78	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2665	'dcmtk::log4cplus::Logger::getInstance': none of the 2 overloads could convert all the argument types	C:\DCMTK\include\dcmtk\oflog\logmacro.h	106	
Error	C2589	'(': illegal token on right side of '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	72	
Error	C2059	syntax error: '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	72	
Error	C2589	'(': illegal token on right side of '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	78	
Error	C2059	syntax error: '::'	C:\DCMTK\include\dcmtk\ofstd\oflimits.h	78	
For example :

tracelog.h
Severity Code Description File Line Suppression State
Error (active) expected an identifier c:\DCMTK\include\dcmtk\ofstd\oflimits.h 72

this is my suggestion
http://prntscr.com/hc2xvt
http://prntscr.com/hc2zoa

but others errors, I can't fix ?

Please, could you check this issues.

Thanks again to Offis team for all support and availability.

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

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#2 Post by J. Riesmeier »

Regarding "oflimits.h", you should consider the following patch: http://git.dcmtk.org/?p=dcmtk.git;a=com ... 2b741dc01b

Regarding the other issue(s): are you compiling with UNICODE or _UNICODE defined?

MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#3 Post by MED_G »

Hi

Thank you for your fast reply.

In fact, after posting this topic, I re-compile and install DCMTK 3.2.6, I repeated all steps, just to ensure that everything is in a good way.

next, I change the new DMTK folder, in my vs2015 project, re-build, and install
now, it seems that problem-related to "oflimits.h", gone, even when I checked this file, I can't find those change, anyway, I applied the patch :)

so, the rest of issues still appeared, comes from "tracelog.h" and "logmacros.h"

I compile with UNICODE

http://prntscr.com/hcact0


Code: Select all

http://prntscr.com/hca57l

Code: Select all

Severity	Code	Description	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)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2665	'dcmtk::log4cplus::Logger::getInstance': none of the 2 overloads could convert all the argument types	C:\DCMTK\include\dcmtk\oflog\logmacro.h	106	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2665	'dcmtk::log4cplus::Logger::getInstance': none of the 2 overloads could convert all the argument types	C:\DCMTK\include\dcmtk\oflog\logmacro.h	106	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	59	
Error	C2678	binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2664	'void dcmtk::log4cplus::Logger::forcedLog(const dcmtk::log4cplus::spi::InternalLoggingEvent &) const': cannot convert argument 3 from 'int' to 'const char *'	C:\DCMTK\include\dcmtk\oflog\tracelog.h	64	
Error	C2665	'dcmtk::log4cplus::Logger::getInstance': none of the 2 overloads could convert all the argument types	C:\DCMTK\include\dcmtk\oflog\logmacro.h	106	
Thank you

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

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#4 Post by J. Riesmeier »

As you can read in the INSTALL file, compiling with UNICODE defined is not supported (in fact, it never was):
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).

MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#5 Post by MED_G »

Hi

Thank you for your reply.
J. Riesmeier wrote:As you can read in the INSTALL file, compiling with UNICODE defined is not supported (in fact, it never was):
So, what do you suggest in this case ?

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

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#6 Post by J. Riesmeier »

Make sure that the macro UNICODE or _UNICODE is not defined when including a DCMTK header file.

MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#7 Post by MED_G »

yes, I verified, but always the same files from come error :
tracelog.h and logmacro.h

MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#8 Post by MED_G »

J. Riesmeier wrote:Make sure that the macro UNICODE or _UNICODE is not defined when including a DCMTK header file.
MED_G wrote:yes, I verified, but always the same files from come error :
tracelog.h and logmacro.h
Please check this :

http://prntscr.com/hcimxw

http://prntscr.com/hcio5j

Hafiz Rafeeq
Posts: 8
Joined: Tue, 2017-10-10, 09:44

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#9 Post by Hafiz Rafeeq »

Make sure that project properties->general->character set is set as "Use Multi-Byte Character Set" and not "Use Unicode Character Set"
Hope that helps

MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#10 Post by MED_G »

Hi Hafiz,
Hafiz Rafeeq wrote:Make sure that project properties->general->character set is set as "Use Multi-Byte Character Set" and not "Use Unicode Character Set"
Hope that helps
Thank you so much for your help.
I found it as " Not Set"

I checked that with my project, and re-build, but always some errors.

Maybe, I must compile and install DCMTK with your setting?
or just create the project again.

Anyway, I appreciate your time :)

MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#11 Post by MED_G »

Hello everyone,


I tried with both Visual Studio 2015 and 2017.

Cmake, ALL_BUILD and INSTALL, done without any problem.

Also, I set the parameter as Hafiz said :
Hafiz Rafeeq wrote:Make sure that project properties->general->character set is set as "Use Multi-Byte Character Set" and not "Use Unicode Character Set"
Hope that helps
and
J. Riesmeier wrote:Regarding "oflimits.h", you should consider the following patch: http://git.dcmtk.org/?p=dcmtk.git;a=com ... 2b741dc01b

Regarding the other issue(s): are you compiling with UNICODE or _UNICODE defined?
Always the same header files from errors come from "tracelog.h" and "logmacros.h"

Any suggestion!

Thank you

MED_G
Posts: 15
Joined: Fri, 2017-11-17, 09:06

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#12 Post by MED_G »

Hi,


Example :

there is an error in this function
macros_get_logger (tchar const * logger)
{
return Logger::getInstance (logger);
}

but if I change

#if defined (UNICODE)
typedef wchar_t tchar;
#else

by this update, the error disappeared

#if defined (UNICODE)
typedef char tchar;
#else

even, I switched character set to " Use Multi-byte Character Set ".



Thank you

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

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#13 Post by J. Riesmeier »

You could also disable the macro definition (temporarily) when including DCMTK header files:

Code: Select all

#pragma push_macro("_UNICODE")
#undef _UNICODE

#include "dcmtk/dcmdata/dctk.h"

#pragma pop_macro("_UNICODE")

eninyo
Posts: 9
Joined: Tue, 2019-05-07, 07:27

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#14 Post by eninyo »

hi,
i have the same problem
using DCMTK version 3.6.4 and VS2017 (64bits).

the setting in the INSTALL project is "Use Multi-Byte Character Set".

still i get the error of:

Code: Select all

\3rdParty\include\dcmtk\oflog\tracelog.h:59: error: C2678: binary '+': no operator found which takes a left-hand operand of type 'const wchar_t [8]' (or there is no acceptable conversion)
any suggestions?

mrikdicom
Posts: 3
Joined: Wed, 2012-12-05, 13:12

Re: Error during build solution : VS 2015 + DCMTK 3.2.6

#15 Post by mrikdicom »

Hello,

Have you try to set the build solution to X86 and right click on your .cpp file then properties in C/C++ tab , go to general then select /CLR in the dropdown list to include common language runtime ?

Reason why to do it on the file instead of the project is that your file might not inherit from the project properties.

Hope it helps if you did not already solved your issue.

Thanks,

Post Reply

Who is online

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