Compile errors trying to build DCMTK

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ChristianHerz
Posts: 22
Joined: Mon, 2007-08-27, 10:37
Contact:

Compile errors trying to build DCMTK

#1 Post by ChristianHerz »

Hello,

I am trying to use decoder of dcmtk and i got several errors of redefinitions. I tried to compile dcmtk and always i got 5 parts of the dcmtk that could not be build successfully. These parts are fundamental for registering the decoder. When I build it with Cxx flags \MT instead of \MD everything went right and everything worked. But using dcmtk within qt i got again errors:

msvcrtd.lib(ti_inst.obj):-1: error: LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
msvcrtd.lib(ti_inst.obj):-1: error: LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)
...

So what's wrong? Within my projects in MSVC i get no errors. With qt i also tried to build in \MT and the mentioned errors occured.

pls help

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

Re: Compile errors trying to build DCMTK

#2 Post by J. Riesmeier »

Did you recompile the whole project (including all DCMTK modules and external libraries) with the same code generation settings?

Also see FAQ #26.

ChristianHerz
Posts: 22
Joined: Mon, 2007-08-27, 10:37
Contact:

Re: Compile errors trying to build DCMTK

#3 Post by ChristianHerz »

Yes I did. I changed everything to \MT and \MTd and it does only compile successful for \MD and \MDd.

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

Re: Compile errors trying to build DCMTK

#4 Post by J. Riesmeier »

But DCMTK compiles and links correctly, i.e. including all command line tools?

ChristianHerz
Posts: 22
Joined: Mon, 2007-08-27, 10:37
Contact:

Re: Compile errors trying to build DCMTK

#5 Post by ChristianHerz »

No, 5 of the DCMTK Library does not compile correctly. By using

Code: Select all

DJEncoderRegistration::registerCodecs(); // register JPEG codecs
in my project I got errors.

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

Re: Compile errors trying to build DCMTK

#6 Post by J. Riesmeier »

My question was whether the DCMTK compiles and links correctly with the used code generation settings (not your project).

ChristianHerz
Posts: 22
Joined: Mon, 2007-08-27, 10:37
Contact:

Re: Compile errors trying to build DCMTK

#7 Post by ChristianHerz »

OK sry. By compiling DCMTK with \MD I get:

Code: Select all

1>------ Build started: Project: ZERO_CHECK, Configuration: Release Win32 ------
2>------ Skipped Build: Project: RUN_TESTS, Configuration: Release Win32 ------
2>Project not selected to build for this solution configuration 
1>Build started 01.05.2013 13:58:06.
1>InitializeBuildStatus:
1>  Creating "Win32\Release\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>FinalizeBuildStatus:
1>  Deleting file "Win32\Release\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild".
1>  Touching "Win32\Release\ZERO_CHECK\ZERO_CHECK.lastbuildstate".
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:01.19
3>------ Build started: Project: dcmsend, Configuration: Release Win32 ------
3>Build started 01.05.2013 13:58:17.
3>InitializeBuildStatus:
3>  Touching "dcmsend.dir\Release\dcmsend.unsuccessfulbuild".
3>CustomBuild:
3>  All outputs are up-to-date.
3>ClCompile:
3>  All outputs are up-to-date.
4>------ Build started: Project: dcmmkdir, Configuration: Release Win32 ------
4>Build started 01.05.2013 13:58:21.
4>InitializeBuildStatus:
4>  Touching "dcmmkdir.dir\Release\dcmmkdir.unsuccessfulbuild".
4>CustomBuild:
4>  All outputs are up-to-date.
4>ClCompile:
4>  All outputs are up-to-date.
3>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
3>     Creating library F:/Bibliotheken/dcmtk/build/lib/Release/dcmsend.lib and object F:/Bibliotheken/dcmtk/build/lib/Release/dcmsend.exp
3>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
3>F:\Bibliotheken\dcmtk\build\bin\Release\dcmsend.exe : fatal error LNK1169: one or more multiply defined symbols found
3>
3>Build FAILED.
3>
3>Time Elapsed 00:00:04.65
5>------ Build started: Project: dcmj2pnm, Configuration: Release Win32 ------
5>Build started 01.05.2013 13:58:22.
5>InitializeBuildStatus:
5>  Touching "dcmj2pnm.dir\Release\dcmj2pnm.unsuccessfulbuild".
5>CustomBuild:
5>  All outputs are up-to-date.
5>ClCompile:
4>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
4>     Creating library F:/Bibliotheken/dcmtk/build/lib/Release/dcmmkdir.lib and object F:/Bibliotheken/dcmtk/build/lib/Release/dcmmkdir.exp
4>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
4>F:\Bibliotheken\dcmtk\build\bin\Release\dcmmkdir.exe : fatal error LNK1169: one or more multiply defined symbols found
4>
4>Build FAILED.
4>
4>Time Elapsed 00:00:01.91
6>------ Build started: Project: dcmdjpeg, Configuration: Release Win32 ------
5>  All outputs are up-to-date.
5>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
5>     Creating library F:/Bibliotheken/dcmtk/build/lib/Release/dcmj2pnm.lib and object F:/Bibliotheken/dcmtk/build/lib/Release/dcmj2pnm.exp
5>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
5>F:\Bibliotheken\dcmtk\build\bin\Release\dcmj2pnm.exe : fatal error LNK1169: one or more multiply defined symbols found
5>
6>Build started 01.05.2013 13:58:24.
5>Build FAILED.
5>
5>Time Elapsed 00:00:01.15
6>InitializeBuildStatus:
6>  Touching "dcmdjpeg.dir\Release\dcmdjpeg.unsuccessfulbuild".
6>CustomBuild:
6>  All outputs are up-to-date.
6>ClCompile:
6>  All outputs are up-to-date.
7>------ Build started: Project: dcmcjpeg, Configuration: Release Win32 ------
7>Build started 01.05.2013 13:58:25.
6>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
6>     Creating library F:/Bibliotheken/dcmtk/build/lib/Release/dcmdjpeg.lib and object F:/Bibliotheken/dcmtk/build/lib/Release/dcmdjpeg.exp
6>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
6>F:\Bibliotheken\dcmtk\build\bin\Release\dcmdjpeg.exe : fatal error LNK1169: one or more multiply defined symbols found
6>
6>Build FAILED.
6>
6>Time Elapsed 00:00:01.14
7>InitializeBuildStatus:
7>  Touching "dcmcjpeg.dir\Release\dcmcjpeg.unsuccessfulbuild".
7>CustomBuild:
7>  All outputs are up-to-date.
7>ClCompile:
7>  All outputs are up-to-date.
7>LIBCMT.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRT.lib(MSVCR100.dll)
7>     Creating library F:/Bibliotheken/dcmtk/build/lib/Release/dcmcjpeg.lib and object F:/Bibliotheken/dcmtk/build/lib/Release/dcmcjpeg.exp
7>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
7>F:\Bibliotheken\dcmtk\build\bin\Release\dcmcjpeg.exe : fatal error LNK1169: one or more multiply defined symbols found
7>
7>Build FAILED.
7>
7>Time Elapsed 00:00:01.03
8>------ Build started: Project: ALL_BUILD, Configuration: Release Win32 ------
8>Build started 01.05.2013 13:58:26.
8>InitializeBuildStatus:
8>  Creating "Win32\Release\ALL_BUILD\ALL_BUILD.unsuccessfulbuild" because "AlwaysCreate" was specified.
8>CustomBuild:
8>  Build all projects
8>FinalizeBuildStatus:
8>  Deleting file "Win32\Release\ALL_BUILD\ALL_BUILD.unsuccessfulbuild".
8>  Touching "Win32\Release\ALL_BUILD\ALL_BUILD.lastbuildstate".
8>
8>Build succeeded.
8>
8>Time Elapsed 00:00:01.48
9>------ Skipped Build: Project: INSTALL, Configuration: Release Win32 ------
9>Project not selected to build for this solution configuration 
========== Build: 2 succeeded, 5 failed, 76 up-to-date, 2 skipped ==========

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

Re: Compile errors trying to build DCMTK

#8 Post by Chung-Yueh Lien »

Have you ever modified the flags "/MTd" and "/MT" in both CMakeLists.txt and CMake GUI ? As I know, CMake will not change the changes if you only modify them in CMake GUI.

The other possible problem is "zlib" because I found the some modules (dcmj2pnm, dcmmkdir, dcmj2pnm, dcmdjpeg) occurring this error are including zlib. Please check the zlib's configure.

ChristianHerz
Posts: 22
Joined: Mon, 2007-08-27, 10:37
Contact:

Re: Compile errors trying to build DCMTK

#9 Post by ChristianHerz »

@Chung-Yueh Lien:

This doesn't change anything. I still get errors. My ZLIB ist also compile with the same flags. It's strange, that these errors only occur with MDd and MD but not with MTd and MT. Are there any other libraries which are mandatory for dcmj2pnm, dcmmkdir, dcmj2pnm and dcmdjpeg ?

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

Re: Compile errors trying to build DCMTK

#10 Post by Chung-Yueh Lien »

I tried to reproduce your problem in my PC, it may be caused by the incorrect supported libraries with inconsistent runtime configuration, that you specified the supported libraries with "Multithreaded" runtime options (/MT and /MTd) configuration, however the configuration of dcmtk is specified as "Multithreaded" runtime options (/MD and /MDd).

If you specify the runtime option of dcmtk as MDd and MD, consequently the supported libraries should be dcmtk-3.6.0-win32-i386-support_MD.zip, vice versa.

That is the reason why other projects were built successfully because they don't link to supported libraries.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest