Ofstd and oflog errors on MSVC 2003 dcmtk-3.6.1_20140617

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
feldman_joel
Posts: 14
Joined: Fri, 2013-01-04, 16:23

Ofstd and oflog errors on MSVC 2003 dcmtk-3.6.1_20140617

#1 Post by feldman_joel »

Hello,

I am trying to build dcmtk-3.6.1_20140617 and I am not having any success. Note that I am able to successfully build dcmtk-3.6.1_20120515 on the same system. I read through the forum.dcmtk.org “DCMTK – Installation” posts. There are many different threads and combinations of issues out there. I understand the complexity of having so many different platforms and why people would have so many issues. I simply would like to compile the software on either a Window XP 32 bit system or a Windows 7 64 bit system. I can use either Microsoft Visual C++ 6.0, Microsoft Visual Studio .NET 2003 (C++), or Microsoft Visual Studio 2008 (C++). I have tried CMake 2.8.9 and CMake 3.1.0. I followed the “Microsoft Windows with CMake” instructions that are provided in the “INSTALL” text file of the release, which seem pretty straight-forward. I take all the default setting that CMake provides and press the configure button. I am surprised how much it can’t find. Here is the list of what CMake says it cannot find:

Code: Select all

stdint.h
dirent.h
fstream.h
fnmatch.h
grp.h
ieeefp.h
inttypes.h
iomanip.h
iostream.h
png.h
ndir.h
netdb.h
pwd.h
semaphore.h
sstream.h
stat.h
cstdint
strings.h
strstream.h
strstrea.h
synch.h
sys/errno.h
sys/dir.h
sys/file.h
sys/ndir.h
sys/param.h
sys/resource.h
sys/select.h
sys/syscall.h
sys/time.h
sys/utsname.h
sys/wait.h
sys/socket.h
sys/thread.h
unistd.h
unix.h
alloca.h
arpa/inet.h
pthread.h
netinet/in_systm.h
netinet/in.h
netinet/tcp.h
I get the “red” screen and press the configure button again followed by the generate button. I have been using my configuration based on “Visual Studio 7 .NET 2003", since I am able to successfully build for dcmtk-3.6.1_20120515 using that platform. I open the DCMTK solution from Visual Studio 7 .NET 2003 and perform the “ALL_BUILD” in debug mode.

When I do the build, I get hundreds of warnings regarding /EHsc, such as:

Code: Select all

C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\include\ostream(574) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
I added /EHsc to in CMake to CMAKE_CXX_FLAGS, CMAKE_CXX_FLAGS_DEBUG, CMAKE_C_FLAGS, and CMAKE_C_FLAGS_DEBUG before pressing "Generate", but does not seem to propagate.
(MAKE_CXX_FLAGS and CMAKE_C_FLAGS option did not seem to exist in list for CMake 2.8.9, only CMake 3.1.0)

I am not sure where to add this to the ALL_BUILD project as its project properties seems very limited.

After the build is completed, it appears the biggest problem is that “ofstd” and “oflog” don’t build due to errors. Here is what I am getting:

fstd - 1 error

Code: Select all

\Dicom\OFFIS\dcmtk-3.6.1_20140617.tar\dcmtk-3.6.1_20140617\dcmtk-3.6.1_20140617\ofstd\libsrc\ofcmdln.cc(1175) : error C2664: 'std::basic_ifstream<_Elem,_Traits>::basic_ifstream(const char *,std::_Iosb<_Dummy>::openmode,int)' : cannot convert parameter 1 from 'const wchar_t *' to 'const char *'

oflog - 98 errors

Code: Select all

\Dicom\OFFIS\dcmtk-3.6.1_20140617.tar\dcmtk-3.6.1_20140617\dcmtk-3.6.1_20140617\oflog\libsrc\snprintf.cc(142) : error C3861: 'vsnprintf': identifier not found, even with argument-dependent lookup
\Dicom\OFFIS\dcmtk-3.6.1_20140617.tar\dcmtk-3.6.1_20140617\dcmtk-3.6.1_20140617\oflog\libsrc\timehelp.cc(178) : error C3861: 'gmtime_s': identifier not found, even with argument-dependent lookup
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock2.h(109) : error C2011: 'fd_set' : 'struct' type redefinition
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock2.h(153) : error C2011: 'timeval' : 'struct' type redefinition
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WinSock2.h(209) : error C2011: 'hostent' : 'struct' type redefinition
lots more winsock.h redefinition errors

Code: Select all

C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WSPiApi.h(128) : error C2440: '=' : cannot convert from 'unsigned long (__stdcall *)(const char *)' to 'DWORD'
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WSPiApi.h(128) : error C2440: '=' : cannot convert from 'unsigned long (__stdcall *)(const char *)' to 'DWORD'
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WSPiApi.h(128) : error C3861: 'inet_addr': identifier not found, even with argument-dependent lookup
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WSPiApi.h(232) : error C2440: '=' : cannot convert from 'hostent *(__stdcall *)(const char *)' to 'hostent *'
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include\WSPiApi.h(232) : error C2440: '=' : cannot convert from 'hostent *(__stdcall *)(const char *)' to 'hostent *'
There are several more WSPiApi.h errors

I am also not sure if part of the problem is related to having multiple versions of Microsoft Studio on my system. Any help on trying to resolve these errors would be appreciated.

Kind regards,

Joel Feldman

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Ofstd and oflog errors on MSVC 2003 dcmtk-3.6.1_20140617

#2 Post by Jan Schlamelcher »

feldman_joel wrote:Code:
C:\Program Files (x86)\Microsoft Visual Studio .NET 2003\Vc7\include\ostream(574) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
Are you building shared libraries? At least I can confirm this issue when building shared libraries, since our compileflag settings are "faulty" in that case. We intend to fix this issue in the upcoming snapshot, maybe fallback to static libraries for now.
feldman_joel wrote:Code:
\Dicom\OFFIS\dcmtk-3.6.1_20140617.tar\dcmtk-3.6.1_20140617\dcmtk-3.6.1_20140617\ofstd\libsrc\ofcmdln.cc(1175) : error C2664: 'std::basic_ifstream<_Elem,_Traits>::basic_ifstream(const char *,std::_Iosb<_Dummy>::openmode,int)' : cannot convert parameter 1 from 'const wchar_t *' to 'const char *'
I believe that to be the same problem which is already addressed in this thread
feldman_joel wrote:I am also not sure if part of the problem is related to having multiple versions of Microsoft Studio on my system.
Most likely, in fact I've never seen these other kinds of errors before. Probable VS 2003 is using the wrong Platform SDK (from a differen Visual Studio installation). Another idea is that this is a VS 2003 (VC7.1) specific problem we don't know of yet; I just looked at our nightly builds and noticed we only test VS 2005 (VC8) and later. VC 6 was dropped entirely by the way. If using VS 2008 is an option for you, maybe try using that one.

feldman_joel
Posts: 14
Joined: Fri, 2013-01-04, 16:23

Re: Ofstd and oflog errors on MSVC 2003 dcmtk-3.6.1_20140617

#3 Post by feldman_joel »

Thank you so much for the prompt response and useful information. I did as you said and everything compiles successfully now using VS2008 for both the 32bit and 64 bit platform!

In summary:

Using CMake 3.1.0, after setting the proper paths and pressing "Configure" for Visual Studio 9 2008, you will need to uncheck "DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS" and press "Generate".

Open VS 2008 and right-click on "ALL_BUILD" and select "Properties". In the "Project Defaults" frame, select the "Configuration Type" property and change it from "Utility" to "Static Library (.lib)" and press "OK".

Right-click on "ALL_BUILD" and select "Build" and everything will now compile.

Note that I had the following three warnings (no errors) when building for the 32 bit platform:

Code: Select all

Warning 1 warning LNK4221: no public symbols found; archive member will be inaccessible	strcloc.obj oflog
Warning 2 warning LNK4221: no public symbols found; archive member will be inaccessible	striconv.obj oflog
Warning 3 warning LNK4221: no public symbols found; archive member will be inaccessible	tls.obj oflog
Note that I had the three warnings (no errors) when building for the 64 bit platform mentioned above, plus 278 more. It appears all of these additional errors are related to "possible loss of data" in going from 32 bit to 64 bit platform. Here are some examples of the warnings:

Code: Select all

Warning 5   warning C4267: 'argument' : conversion from 'size_t' to 'const Uint16', possible loss of data        \Dicom\OFFIS\dcmtk-3.6.1_20140617\dcmnet\libsrc\assoc.cc      1297 dcmnet
Warning 10  warning C4267: 'initializing' : conversion from 'size_t' to 'int', possible loss of data             \Dicom\OFFIS\dcmtk-3.6.1_20140617\dcmwlm\wwwapps\writwlst.cc  110  writwlst
Warning 12  warning C4244: '=' : conversion from 'SOCKET' to 'int', possible loss of data                        \Dicom\OFFIS\dcmtk-3.6.1_20140617\dcmnet\libsrc\dulfsm.cc     2196 dcmnet
Warning 25  warning C4267: '+=' : conversion from 'size_t' to 'unsigned long', possible loss of data             \Dicom\OFFIS\dcmtk-3.6.1_20140617\dcmimage\libsrc\diqthash.cc 46   dcmimage
Warning 27  warning C4267: 'return' : conversion from 'size_t' to 'unsigned long', possible loss of data         \Dicom\OFFIS\dcmtk-3.6.1_20140617\dcmrt\libsrc\drtwps.cc      265  dcmrt
Warning 43  warning C4267: 'argument' : conversion from 'size_t' to 'Uint32', possible loss of data              \Dicom\OFFIS\dcmtk-3.6.1_20140617\dcmjpls\libsrc\djcodece.cc  677  dcmjpls
Warning 117 warning C4267: 'argument' : conversion from 'size_t' to 'const unsigned long', possible loss of data \Dicom\OFFIS\dcmtk-3.6.1_20140617\dcmjpeg\libsrc\djcodece.cc  1002 dcmjpeg
Thank you again for your prompt attention and providing this great toolkit!

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: Ofstd and oflog errors on MSVC 2003 dcmtk-3.6.1_20140617

#4 Post by Jan Schlamelcher »

feldman_joel wrote:It appears all of these additional errors are related to "possible loss of data" in going from 32 bit to 64 bit platform.
See this nearly one year old thread regarding that issue. I hope I find the time to fix the remaining warnings in the near future.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest