Dependencies within several source header files (c++)

Compilation and installation of DCMTK

Moderator: Moderator Team

Message
Author
Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Dependencies within several source header files (c++)

#1 Post by Oliver Neubauer »

Hey,

I want to develope an application to read dicom files and process the header information like patient name. The development environment is visual studio professional 2010 (32-bit-compiler), programming language c++ and the opering system windows 7 (64 bit).

So, I downloaded the source code of dcmtk from your website (http://dicom.offis.de/dcmtk, section: "DCMTK 3.6.0 - source code and documentation (2011-01-06)", file: "dcmtk-3.6.0.zip"). Afterwards, I generated the project DCMTK.sln using cmake (release 2.8). After compilation of this project, the library files were created. Then, I included the source and library files in my project "dicom reader".

After the statement

#include <dcmimgle\include\dcmtk\dcmimgle\diimage.h>

in my source code, I got an error and the message

"c:\dcmtk-3.6.0\dcmtk-3.6.0\dcmimgle\include\dcmtk\dcmimgle\diimage.h(33): fatal error C1083: Datei (Include) kann nicht geöffnet werden: "dcmtk/config/osconfig.h": No such file or directory"

What is wrong? Should I solve some dependencies in the header files? Could be the mistakes in the build process of the library files?

Can anybody solve this problem? Thanks a lot for your support :-)

Best regards,

Oliver

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

Re: Dependencies within several source header files (c++)

#2 Post by J. Riesmeier »

First of all, after compiling the DCMTK, you should INSTALL it in order to get a proper directory scheme (see documentation).
Then, in your code, you should include the DCMTK header files with '#include "dcmtk/dcmimgle/diimage.h"'... of course, you also need to tell the compiler where the include directory of the DCMTK is, e.g. "c:\source\dcmtk-install\include".

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Dependencies within several source header files (c++)

#3 Post by Oliver Neubauer »

Thanks for your response.

What do you mean about "you should INSTALL it in order to get a proper directory scheme"? Should I install the DICOM viewer or another software? Which documentation do you mean?

According the "INSTALL"-File (http://support.dcmtk.org/docs/file_install.html), section: "BUILDING (Windows)", I generated the project using cmake. After that, I opened the project "DCMTK.sln" with visual studio and compiled it. The libraries and .exe files were created. The .exe files are in the dictionary "C:\dcmtk_bin\executables\Debug". Thats my state. Should I execute all .exe files? How I should continue?

Of course, I told the compiler, where the include directory of DCMTK is.

Thanks :-)

Greetings,

Oliver

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

Re: Dependencies within several source header files (c++)

#4 Post by J. Riesmeier »

Excerpt from the INSTALL file (you've referenced):
The "INSTALL" subproject installs the executables, libraries, include, support and documentation files (very similar to "make install-all" on Unix systems).
This is what I meant with "you should INSTALL".

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Dependencies within several source header files (c++)

#5 Post by Oliver Neubauer »

Sorry for ask again.

I built the project using cmake according the guide. After that, I compiled (only) the subproject "INSTALL" in visual studio.

My directory structure is as follows:

C:\dcmtk-3.6.0
\bin (there are the .exe files, libraries, visual studio files)
\CMake
\config
\dcmdata
\dcmimage
...<other modules>

I specify to the compiler and linker in my visual studio project following things:

- include path to the header files (C:\dcmtk-3.6.0)
- path to libraries (C:\dcmtk-3.6.0\bin\Debug)
- a list of library files (that´s 19 *.lib files, e.g. charls.lib)

Is that right until this point?

I wrote the statement "#include <dcmimage\include\dcmtk\dcmimage\dicoimg.h>" in my code.

The file "dicoimg.h" includes the statements

#include "dcmtk/config/osconfig.h",
#include "dcmtk/dcmimgle/diimage.h",
#include "dcmtk/dcmimage/dicopx.h",

which produce an error, because the files are not found. Should I have to adjust the pathes manually? Or occurs the error during the build process using cmake?

Best regards,

Oliver

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

Re: Dependencies within several source header files (c++)

#6 Post by J. Riesmeier »

My directory structure is as follows:

C:\dcmtk-3.6.0
\bin (there are the .exe files, libraries, visual studio files)
\CMake
\config
\dcmdata
\dcmimage
...<other modules>
This is not the directory structure that is created by the INSTALL target. I guess you were looking into the build directory.
Is that right until this point?
No, your include path to the header files is wrong and also your "path to libraries".

After INSTALLing the DCMTK, the top-level directory structure should be: bin, etc, include, lib, share (pretty much like what is common practice on Unix).

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Dependencies within several source header files (c++)

#7 Post by Oliver Neubauer »

Is there another possibility to get the libraries of dcmtk except using cmake? I saw the executable binaries on your website (http://dicom.offis.de/dcmtk, section: DCMTK 3.6.0 - executable binaries, file: dcmtk-3.6.0-win32-i386.zip). Its directory structure is similar to this, what you described:

dcmtk-3.6.0-win32-i386
\bin
\etc
\man
\share

But how can I use this in my project?

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

Re: Dependencies within several source header files (c++)

#8 Post by J. Riesmeier »

No, there is no official download package for the DCMTK libraries, but as far as I understood compilation of the DCMTK was no problem for you, right? For the installation step, make sure that you've specified an appropriate value for CMAKE_INSTALL_PREFIX in the CMake user interface, this is the directory where the DCMTK gets installed.

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Dependencies within several source header files (c++)

#9 Post by Oliver Neubauer »

Seeming, compilation of the DCMTK is a problem. In the following is my way of proceeding step by step:

1.) Download of DCMTK from your website (http://dicom.offis.de/dcmtk, section: "DCMTK 3.6.0 - source code and documentation (2011-01-06)", file: "dcmtk-3.6.0.zip")

2.) Unzip the folder

3.) Open cmake gui

4.) I enter in the field "Where is the source code:" the path "C:/Users/Oliver/Downloads/dcmtk-3.6.0/dcmtk-3.6.0"

5.) I create the new folder "C:\dcmtk"

6.) I enter the path "C:/dcmtk" in the field "Where to build the binaries:"

7.) I press "Configure"

8.) In the dropdown menu "Specify the generator for this project", I select the entry "Visual Studio 10"; I let the radio button on "Use default native compilers"

9.) I press "Finish"

<cmake is generating>

10.) I see some variables in the table in red color. The variable "CMAKE_INSTALL_PREFIX" is set on "C:/Program Files (x86)/DCMTK". I let all variables unchanged.

11.) I create the folder "C:\Program Files (x86)\DCMTK"

12.) I press "Generate"

<cmake is generating the project files in the folder "C:\dcmtk">

13.) I open the project file "C:\dcmtk\DCMTK.sln"

14.) I compile the subproject "INSTALL"

<the compiler is generating the code; no errors>

I expected, that the folder "C:\Program Files (x86)\DCMTK" contains the binaries and include files. But the folder is empty.

What was wrong? Do you see the failure?

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

Re: Dependencies within several source header files (c++)

#10 Post by J. Riesmeier »

Either you do not have the rights to write in the specified directory (although I would expect that CMake moans on this) or there is an issue with the blanks in your path.

So, I would recommend to test with CMAKE_INSTALL_PREFIX="c:\dcmtk-install" (if appropriate). Also before building "INSTALL" you should manually select "ALL_BUILD" - not sure whether this makes any difference since I'm currently working on my Linux machine and cannot test it myself.

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Dependencies within several source header files (c++)

#11 Post by Oliver Neubauer »

I created the folder "C:\dcmtk_install" and changed the value of the variable "CMAKE_INSTALL_PREFIX" to "C:/dcmtk_install". I opened the project file "C:\dcmtk\DCMTK.sln" and compiled the project "ALL_BUILD".

Unfortunately, the folder "C:/dcmtk_install" is still empty. By the way, after compiling of "ALL_BUILD", I got the message

"The program "C:\dcmtk\Debug\ALL_BUILD" cannot be started. The system cannot find the file"

Is anything else wrong?

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

Re: Dependencies within several source header files (c++)

#12 Post by J. Riesmeier »

I'm sorry but I have no clue. And, what I still do not understand: Does compilation of the DCMTK work or not?
Unfortunately, the folder "C:/dcmtk_install" is still empty.
But you selected and built the INSTALL target? Was there is any error message?
By the way, after compiling of "ALL_BUILD", I got the message
Very strange. But it used to work before?

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Dependencies within several source header files (c++)

#13 Post by Oliver Neubauer »

And, what I still do not understand: Does compilation of the DCMTK work or not?
The compilation works fine. No dialog box with errors during this time. In the following, I quote some excerpts from the output window:

"Das Verzeichnis "C:\dcmtk_src\BUILD\BUILD-3.6.0\Debug\" wird erstellt."
""Win32\Debug\ZERO_CHECK\ZERO_CHECK.unsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde."
""Win32\Debug\ALL_BUILD\ALL_BUILD.unsuccessfulbuild" wird erstellt, da "AlwaysCreate" angegeben wurde."
"Die Datei "Win32\Debug\ALL_BUILD\ALL_BUILD.unsuccessfulbuild" wird gelöscht."

The last two messages are in conflict with each other. Do you have any idea, how I influence this points?
But you selected and built the INSTALL target? Was there is any error message?
I selected and built the subproject "INSTALL" (I guess, you meant this?). The only error message was, that the program "ALL_BUILD" can´t be started (the message occurs after compilation). I compiled the project in "Debug" modus and Win 32. Is that correct?
Very strange. But it used to work before?
I never used cmake before.

I can send some screenshots for more details to you.

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

Re: Dependencies within several source header files (c++)

#14 Post by J. Riesmeier »

I just compiled DCMTK 3.6.0 with VisualStudio 2010 Express (32-bit) on a Window 7 (64-bit) system and everything was OK, including the installation of the DCMTK. My CMake version was the latest one (2.8.12.2), but it should also work with older versions( starting from 2.4).

Unfortunately, I have no idea what's wrong with your environment. Maybe, you should reinstall CMake and build the DCMTK from scratch, i.e. extract the source code archive into a new directory and create a new build and install directory.

Oliver Neubauer
Posts: 19
Joined: Fri, 2014-03-14, 12:43

Re: Dependencies within several source header files (c++)

#15 Post by Oliver Neubauer »

Unfortunately, it doesn´t work correctly. I installed VisualStudio 2010 Express, 32-bit (my previous version was VisualStudio 2010 professional). But I think, it makes no difference.

I also work with cmake 2.8.12.2. Maybe, it is somthing wrong with my cmake installation. I downloaded the installer from heise website (http://www.heise.de/download/574d6321e4 ... 12792.html). You too?

Ok, thanks for your support.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest