Error compilation sample program in VS 2010

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
TechnoMag82
Posts: 3
Joined: Fri, 2011-12-23, 10:37

Error compilation sample program in VS 2010

#1 Post by TechnoMag82 »

Hi.
I am trying to create a test application which using dcmdata.
I use CMake to generate dcmtk, then use VS2010 to build it successfully.
CMake was configured by default.
In new Solution for my application I set paths to include headers of dcmtk, and compiled .lib files. In additional dependencies for VC linker, I added files:
dcmdata.lib
netapi32.lib
wsock32.lib
ofstd.lib

At first building my application, i have more than 86 errors. After included #define in my source, number of errors decreased.

My source:

Code: Select all

#define HAVE_CONFIG_H // don't work!
#define DHAVE_CONFIG_H // don't work!
#define HAVE_STRSTREAM
#define HAVE_CLASS_TEMPLATE
#include "dcmtk/config/osconfig.h"
#define HAVE_STD_STRING
#define USE_STD_CXX_INCLUDES // ðàçðåøàåì èñïîëüçîâàíèå èíêëóäû âèäà <iostream>
#define USING_STD_NAMESPACE // ðàçðåøàåì èñïîëüçîâàíèå ñòàíäàðòíîãî ïðîñòðàíñòâà èìåí
#define HAVE_SSTREAM // ðàçðåøàåì èñïîëüçîâàíèå <strstream>

#define PACKAGE_DATE
#define PACKAGE_VERSION
#define PACKAGE_VERSION_NUMBER
#define HAVE_CLASS_TEMPLATE // ðàçðåøàåì èñïîëüçîâàòü øàáëîíû
#define _WIN32
#define WIDE_CHAR_FILE_IO_FUNCTIONS
#define HAVE_STD_NAMESPACE
#define HAVE_STL_LIST // ðàçðåøàåì èñïîëüçîâàòü äèíàìè÷åñêèå ñòðóêòóðû äàííûõ STL
#define HAVE_STL // ðàçðåøàåì èñïîëüçîâàòü äèíàìè÷åñêèå ñòðóêòóðû äàííûõ STL
#define STDIO_NAMESPACE

#define INCLUDE_UNISTD
#define INCLUDE_CSTDIO
#define INCLUDE_CSTRING
#define INCLUDE_CSTDARG
#define INCLUDE_CERRNO

#include "dcmtk/dcmdata/dctk.h"
#include "dcmtk/dcmdata/dcdeftag.h" 
#include "dcmtk/dcmdata/dcfilefo.h" 
#include "dcmtk/ofstd/ofstring.h"
#include "dcmtk/ofstd/ofcond.h"
#include "dcmtk/ofstd/ofstdinc.h"


#include <iostream>
//using namespace std;

int main()
{
DcmFileFormat fileformat;
OFCondition status = fileformat.loadFile("test.dcm");
if (status.good())
{
  OFString patientName;
  if (fileformat.getDataset()->findAndGetOFString(DCM_PatientName, patientName).good())
  {
    std::cout << "Patient's Name: " << patientName << std::endl;
  }
  else
  {
    std::cerr << "Error: cannot access Patient's Name!" << std::endl;
  }
} else
  std::cerr << "Error: cannot read DICOM file (" << status.text() << ")" << std::endl;
	return 0;
};
error C2440: =: cannot convert "OFBool" to "FILE *" d:\dcmtk-3.6.0-cmake\ofstd\include\dcmtk\ofstd\offile.h 145 1 dcmtk_test
error C2660: OFFile::freopen: function not have 3 arguments d:\dcmtk-3.6.0-cmake\ofstd\include\dcmtk\ofstd\offile.h 223 1 dcmtk_test
But, I'm unsure that I chose the right way.
Please help me in to fix this problem.

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

#2 Post by J. Riesmeier »

Did you check FAQ #47?

TechnoMag82
Posts: 3
Joined: Fri, 2011-12-23, 10:37

#3 Post by TechnoMag82 »

J. Riesmeier wrote:Did you check FAQ #47?
Thanks, I'm read FAQ $47.
I'm stopped in step 4.
I can't install files for target INSTALL - step 4.
I'm "Select target INSTALL in order to install the DCMTK files to the directory specified using CMake", and select Menu "Run without debug".
Displayed Error MessageBox: "Can't find programm INSTALL".
If I only select target INSTALL, files are not copied.

what am I doing wrong?

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

#4 Post by J. Riesmeier »

Are you sure that CMake is properly installed? I personally have never seen this kind of error.

TechnoMag82
Posts: 3
Joined: Fri, 2011-12-23, 10:37

#5 Post by TechnoMag82 »

I installed gui CMake 2.8.6 (cmake-2.8.6-win32-x86.exe) in d:\CMake 2.8\

Where is source code: D:/dcmtk-3.6.0-cmake
Where to build the binaries: D:/dcmtk

After configuration, cmake gave the following results:

Code: Select all

CMAKE_BACKWARDS_COMPATIBILITY 2.4
CMAKE_INSTALL_PREFIX "C:\PROGRAM FILES\DCMTK"
DCMTK_OVERWRITE_WIN32_COMPILER_FLAGS TRUE
DCMTK_WITH_DOXYGEN FALSE
DCMTK_WITH_OPENSSL FALSE
DCMTK_WITH_PNG FALSE
DCMTK_WITH_PRIVATE_TAGS FALSE
DCMTK_WITH_THREADS TRUE
DCMTK_WITH_TIFF FALSE
DCMTK_WITH_XML FALSE
DCMTK_WITH_ZLIB FALSE
EXECUTABLE_OUTPUT_PATH ""
LIBRARY_OUTPUT_PATH ""

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

#6 Post by J. Riesmeier »

Maybe, your installation directory ("C:\PROGRAM FILES\DCMTK") is not writable?

kamil
Posts: 63
Joined: Fri, 2009-04-17, 09:18

#7 Post by kamil »

I think we have the same problem.
viewtopic.php?p=13057#13057

Shaeto
Posts: 147
Joined: Tue, 2009-01-20, 17:50
Location: CA, USA
Contact:

#8 Post by Shaeto »

i see define for HAVE_STD_STRING in the application source, was DCMTK compiled this same option ?

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

#9 Post by J. Riesmeier »

Correct, don't ever set the defines in your application source only. Either use the project/makefile settings of your development environment or add it to "osconfig.h".

Post Reply

Who is online

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