Compiling error when including dctk.h

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
kattabomane
Posts: 43
Joined: Tue, 2005-02-01, 22:53

Compiling error when including dctk.h

#1 Post by kattabomane »

Hello,

I get several compilation errors when including dctk.h or other files such as dcdict.h.
Here are the examples :
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2365: 'new' : redefinition; previous definition was a 'member function'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2491: 'new' : definition of dllimport data not allowed
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2078: too many initializers
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2440: 'initializing' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2143: syntax error : missing ';' before '('
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29) : error C2226: syntax error : unexpected type 'size_t'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(30) : error C2059: syntax error : ')'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(33) : warning C4229: anachronism used : modifiers on data are ignored
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(33) : error C2365: 'new' : redefinition; previous definition was a 'member function'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(33) : error C2491: 'new' : definition of dllimport data not allowed
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(33) : error C2078: too many initializers
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(33) : error C2440: 'initializing' : cannot convert from 'int' to 'void *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(33) : error C2143: syntax error : missing ';' before '['
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(33) : error C3409: empty attribute block is not allowed
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(34) : warning C4091: '' : ignored on left of '__w64 unsigned int' when no variable is declared
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(34) : error C2143: syntax error : missing ';' before ','
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(34) : error C2059: syntax error : ','
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(34) : fatal error C1004: unexpected end of file found
What is wrong ?
Thanks in advance for your help.

kattabomane
Posts: 43
Joined: Tue, 2005-02-01, 22:53

Compilation

#2 Post by kattabomane »

Hello,
I am really blocked in this situation.
Is someone can give me any advise or a small clue to dig ?
Thanks

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#3 Post by Marco Eichelberg »

To ask the obvious, are you sure that you are including "osconfig.h" before including "dctk.h"?

kattabomane
Posts: 43
Joined: Tue, 2005-02-01, 22:53

Inclusion error

#4 Post by kattabomane »

Hello,
I finally found out the problem.
In fact, i have set the inclusion headers after the debug directives.
After having modified this, i can now compile without any errors.
Thanks.

Aimevous
Posts: 37
Joined: Thu, 2008-05-15, 11:02

#5 Post by Aimevous »

Oh I got the same error and after putting the statements before the debug directives, I dont have the whole chunk of error.
btw, how does putting the include statements after the debug directives screw up the whole thing?

btw I have the following warning though:

Code: Select all

\include\dcmtk\dcmdata\dcdict.h(88) : warning C4267: 'return' : conversion from 'size_t' to 'int', possible loss of data
what does this mean?

My program simply only have the 2 include statements at the top and nothing else...

Since it is a warning, I decided to not worry about it and I added the following line of code into my button click procedure:

Code: Select all

testD error LNK2019: unresolved external symbol "public: virtual __thiscall DcmFileFormat::~DcmFileFormat(void)" (??1DcmFileFormat@@UAE@XZ) referenced in function "public: void __thiscall CtestDDlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CtestDDlg@@QAEXXZ)
testD error LNK2019: unresolved external symbol "public: __thiscall DcmFileFormat::DcmFileFormat(void)" (??0DcmFileFormat@@QAE@XZ) referenced in function "public: void __thiscall CtestDDlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CtestDDlg@@QAEXXZ)
testD fatal error LNK1120: 2 unresolved externals

whats this?

thanks![/code]

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#6 Post by Marco Eichelberg »

Ignore the warning. The linker error obviously means that you are not linking all libraries needed, specifically, libdcmdata and libofstd.

Aimevous
Posts: 37
Joined: Thu, 2008-05-15, 11:02

#7 Post by Aimevous »

Oops just realised I had a typo in my posting.

What I meant was that when I have simply this line of code:

Code: Select all

DcmFileFormat fileformat;
I get this linking error and I can't compile:

Code: Select all

testD fatal error LNK1120: 2 unresolved externals
testD error LNK2019: unresolved external symbol "public: virtual __thiscall DcmFileFormat::~DcmFileFormat(void)" (??1DcmFileFormat@@UAE@XZ) referenced in function "public: void __thiscall CtestDDlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CtestDDlg@@QAEXXZ)
testD error LNK2019: unresolved external symbol "public: __thiscall DcmFileFormat::DcmFileFormat(void)" (??0DcmFileFormat@@QAE@XZ) referenced in function "public: void __thiscall CtestDDlg::OnBnClickedButton1(void)" (?OnBnClickedButton1@CtestDDlg@@QAEXXZ)

The top part of my cpp is simply just this:

Code: Select all

#include "stdafx.h"
#include "testD.h"
#include "testDDlg.h"
#include ".\testddlg.h"

#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dctk.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif
I'm trying to build a simply gui using mfc...
Marco Eichelberg wrote:Ignore the warning. The linker error obviously means that you are not linking all libraries needed, specifically, libdcmdata and libofstd.
I've tried recompiling but I can't seem to find those 2 libraries around?
Sorry, but I'm a bit lost here now...
What should I do?

Please help!

Aimevous
Posts: 37
Joined: Thu, 2008-05-15, 11:02

#8 Post by Aimevous »

I think I found out how to add the libraries to link..do correct me if I'm wrong.

I simply right clicked my project and selected "Properties" and under "Additional Dependencies" I added all the libraries in.

Image
Is this the correct way of doing linking?

But after doing this and hitting compile, I get the following error:

Code: Select all

MyProgram fatal error LNK1106: invalid file or disk full: cannot seek to 0x6584
When I double click on the error, it brings me to dcm2xml.dtd

What is this?

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1445
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#9 Post by Marco Eichelberg »

The order in which libraries are linked is significant, and does not seem to be correct. See FAQ #27. And you should certainly not try to feed an XML DTD into the linker. Very bad idea.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest