Errors while compiling dcmtk 3.6.0 with VC++ 6.0

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
liuxinming
Posts: 83
Joined: Thu, 2009-03-19, 04:19

Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#1 Post by liuxinming »

Hello everyone,

Does anyone has seen this error:

dcmtk-3.6.0\dcmjpls\libcharls\scan.h(780) : error C2899: typename cannot be used outside a template declaration

during compilation?

if someone could give me some suggestions, thanks by advance!
Last edited by liuxinming on Wed, 2013-07-10, 10:46, edited 1 time in total.

Chung-Yueh Lien
Posts: 61
Joined: Wed, 2010-05-19, 09:27
Location: Taipei, Taiwan

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#2 Post by Chung-Yueh Lien »

Have you defined the activate "HAVE_TYPENAME" ?
Hint: in osconfig.h,

Code: Select all

/* define if the compiler recognizes typename */
#define HAVE_TYPENAME 1

liuxinming
Posts: 83
Joined: Thu, 2009-03-19, 04:19

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#3 Post by liuxinming »

Chung-Yueh Lien wrote:Have you defined the activate "HAVE_TYPENAME" ?
Hint: in osconfig.h,

Code: Select all

/* define if the compiler recognizes typename */
#define HAVE_TYPENAME 1
I' ve just opened osconfig.h and seen these two lines you' ve mentioned. So What shall I do next?

Chung-Yueh Lien
Posts: 61
Joined: Wed, 2010-05-19, 09:27
Location: Taipei, Taiwan

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#4 Post by Chung-Yueh Lien »

you can try to deactivate HAVE_TYPENAME.

liuxinming
Posts: 83
Joined: Thu, 2009-03-19, 04:19

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#5 Post by liuxinming »

Done! Thanks a lot!

But there is another problem which being described as follow:
dcmimgle\libsrc\didispfn.cxx(347) :error C2039: 'nocreate' : is not a member of 'basic_ios<char,struct std::char_traits<char> >'

Since C++ no longer supports ios::nocreate, what do I have to do with this issue?

Chung-Yueh Lien
Posts: 61
Joined: Wed, 2010-05-19, 09:27
Location: Taipei, Taiwan

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#6 Post by Chung-Yueh Lien »

Hi, please take a look at dcmconfig.h and find something like this:

Code: Select all

Define if your system defines ios::nocreate in iostream.h */
/* #undef HAVE_IOS_NOCREATE */
enable the flag "HAVE_IOS_NOCREATE" and run CMake to make a correct configuration.

liuxinming
Posts: 83
Joined: Thu, 2009-03-19, 04:19

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#7 Post by liuxinming »

Chung-Yueh Lien wrote:enable the flag "HAVE_IOS_NOCREATE" and run CMake to make a correct configuration.
It did the trick. I' ve modified this flag.

One more problem is that this error:
error C2733: second C linkage of overloaded function 'wmemchr' not allowed
appeared while compiling

I know that it is related to C linkage and I' ve searched all the configurations in osconfig.h and didn' t find anything about it.
Shall I modify some flags elsewhere?

Chung-Yueh Lien
Posts: 61
Joined: Wed, 2010-05-19, 09:27
Location: Taipei, Taiwan

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#8 Post by Chung-Yueh Lien »

liuxinming wrote: One more problem is that this error:
error C2733: second C linkage of overloaded function 'wmemchr' not allowed
appeared while compiling
It's caused by more than one overloaded function "wmemchr" is declared with C linkage. Also, DCMTK does not include wmemchr function, i.e. at least I have checked it. The solution is as following (I did not test it!):

Code: Select all

#ifdef __cplusplus
  extern "C" 
  {
#endif
#include <wchar.h>
#ifdef __cplusplus
  }
#endif

liuxinming
Posts: 83
Joined: Thu, 2009-03-19, 04:19

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#9 Post by liuxinming »

I' ve found the following codes in osconfig.h:

Code: Select all

#ifdef __cplusplus
#define BEGIN_EXTERN_C extern "C" {
#define END_EXTERN_C }
#else
#define BEGIN_EXTERN_C
#define END_EXTERN_C
#endif
and I replaced them with the codes you' ve written above, this error did not arise any more.

My Last two questions are both about warnings
LINK : warning LNK4049: locally defined symbol "_xmlFree" imported
warning C4273: 'mktemp' : inconsistent dll linkage. dllexport assumed.


I' ve used the previous snapshot of dcmtk before and the warnings still appeared during compiling. I did not want to ignore them. Could you please give me some suggestions?

Chung-Yueh Lien
Posts: 61
Joined: Wed, 2010-05-19, 09:27
Location: Taipei, Taiwan

Re: Errors while compiling dcmtk 3.6.0 with VC++ 6.0

#10 Post by Chung-Yueh Lien »

liuxinming wrote: LINK : warning LNK4049: locally defined symbol "_xmlFree" imported
This warning seems harmless. It is caused originally from libxml2 while compiling in debug mode in MSVC.
If you really want to fix it, you have to modify some source of libmxl2 by yourself and then re-compile libxml2 with correct flags. Please see: http://msdn.microsoft.com/en-us/library/atww7hec.aspx in more detail.
liuxinming wrote: warning C4273: 'mktemp' : inconsistent dll linkage. dllexport assumed.
This warning is caused by /MT and /MTd flags. Please check those in consistency CMake configuration.

Post Reply

Who is online

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