Logs layout error

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Logs layout error

#1 Post by ruben.cruz »

Hi,

I am trying for a couple of days to fix this problem.
So, i am trying to create a generic pattern for logs using your samples into something like this:

Code: Select all

const char *pattern = "%D{%Y-%m-%d %H:%M:%S.%q} %5p: %m%n";
OFunique_ptr<dcmtk::log4cplus::Layout> layout(new dcmtk::log4cplus::PatternLayout(pattern));
logfile->setLayout(OFmove(layout));
but on compile i have the following fatal errors:

Code: Select all

1>MyForm.obj : error LNK2028: unresolved token (0A0007D1) "private: __cdecl OFunique_ptr<class dcmtk::log4cplus::Layout>::OFunique_ptr<class dcmtk::log4cplus::Layout>(class OFunique_ptr<class dcmtk::log4cplus::Layout> const &)" (??0?$OFunique_ptr@VLayout@log4cplus@dcmtk@@@@$$FAEAA@AEBV0@@Z) referenced in function "public: static void __clrcall OFunique_ptr<class dcmtk::log4cplus::Layout>::<MarshalCopy>(class OFunique_ptr<class dcmtk::log4cplus::Layout> *,class OFunique_ptr<class dcmtk::log4cplus::Layout> *)" (?<MarshalCopy>@?$OFunique_ptr@VLayout@log4cplus@dcmtk@@@@$$FSMXPEAV1@0@Z)
1>MyForm.obj : error LNK2019: unresolved external symbol "private: __cdecl OFunique_ptr<class dcmtk::log4cplus::Layout>::OFunique_ptr<class dcmtk::log4cplus::Layout>(class OFunique_ptr<class dcmtk::log4cplus::Layout> const &)" (??0?$OFunique_ptr@VLayout@log4cplus@dcmtk@@@@$$FAEAA@AEBV0@@Z) referenced in function "public: static void __clrcall OFunique_ptr<class dcmtk::log4cplus::Layout>::<MarshalCopy>(class OFunique_ptr<class dcmtk::log4cplus::Layout> *,class OFunique_ptr<class dcmtk::log4cplus::Layout> *)" (?<MarshalCopy>@?$OFunique_ptr@VLayout@log4cplus@dcmtk@@@@$$FSMXPEAV1@0@Z)

The code works fine if i not set the Layout (logfile->setLayout(OFmove(layout));) meaning that maybe i am missing something to help it to solve something.
Any tip?

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

Re: Logs layout error

#2 Post by J. Riesmeier »

Which version of the DCMTK do you use?

ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Re: Logs layout error

#3 Post by ruben.cruz »

J. Riesmeier wrote: Fri, 2019-07-19, 13:17 Which version of the DCMTK do you use?
dcmtk-3.6.4

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

Re: Logs layout error

#4 Post by J. Riesmeier »

If "logfile" is something like the following it should work:

Code: Select all

dcmtk::log4cplus::SharedAppenderPtr logfile(new dcmtk::log4cplus::FileAppender("example.log"));
Are you sure that you link the correct libraries?

ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Re: Logs layout error

#5 Post by ruben.cruz »

Code: Select all

#include "dcmtk/config/osconfig.h" 
#include "dcmtk/dcmdata/dcdatset.h"
#include "dcmtk/dcmnet/scpcfg.h"
#include "dcmtk/dcmnet/scppool.h"
#include "dcmtk/dcmnet/scpthrd.h"

#include "dcmtk/dcmnet/dstorscp.h"
#include "dcmtk/dcmnet/dstorscu.h"

#include "dcmtk/ofstd/ofmem.h"
#include "dcmtk/oflog/oflog.h"
#include "dcmtk/oflog/fileap.h"
hi,
this are the ones i am linking atm in that file, there is a couple more that are not about dcmtk
Am i forgetting anything?

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

Re: Logs layout error

#6 Post by J. Riesmeier »

I was asking for the libraries that you link, not the header files you include. As far as I can see, LNK2028 and LNK2019 are linker errors.

By the way, how do you link the DCMTK to your program: statically or dynamically (i.e. as a DLL)?

ruben.cruz
Posts: 43
Joined: Fri, 2019-05-03, 15:06

Re: Logs layout error

#7 Post by ruben.cruz »

J. Riesmeier wrote: Mon, 2019-07-22, 10:37 By the way, how do you link the DCMTK to your program: statically or dynamically (i.e. as a DLL)?
I am sorry, but i don't really know how to check this. I have been following a couple of tutorials on how to use DCMTK in c++/cli with windows forms.
I believe it is something can find in the properties, but i am not familiar with the concept of static or dinamic libraries.

ichimura.t
Posts: 5
Joined: Tue, 2015-02-10, 10:02

Re: Logs layout error

#8 Post by ichimura.t »

This error solved? I have same problem.

Post Reply

Who is online

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