[Dcmlib] compile problem in windows

Jean-Pierre Roux jpr at creatis.insa-lyon.fr
Fri Oct 26 18:48:21 CEST 2007


Greg Book wrote:
> I was able to successfully compile gdcm using CMake, and then 
> VC++2005. (the latest version 1.3.2 downloaded from the gdcm website) 
> I tried creating static libs and non-static libs. Both compiled and 
> created the .lib and .dll files. When I tried to compile either of the 
> libs into my program, I get lots of link errors. I've successfully 
> compiled my program before using the 1.2.2 version of gdcm. What might 
> be going on? I'm also wondering if there is a step by step tutorial on 
> how to compile gdcm and use the lib in programs?
>

Hi, Greg.
I just read again you mail, more carefully.
You said that you used gdcm1.2.2 and  your own programs linked corectly;
You downloaded gdcm1.3.2, and you get link errors on your programs, right?

In gdcm1.2, we made some stupid things, and we had to break the API, on 
gdcm1.3 ...

On :
http://www.creatis.univ-lyon1.fr/Public/Gdcm
--> News
you can find :

    * Stupid difference between gdcm::ValEntry and gdcm::BinEntry removed.
      Only gdcm::DataEntry exist, now. Should have been considered as a
      'Bug Fix'.
      Actually, it's an API breaking modification ...
          o std::string const &DataEntry::GetString() const
            returns as a string (when possible) the value of the DataEntry
          o void DataEntry::SetString(std::string const &value)
            Sets the 'value' of a DataEntry, passed as a std::string
          o void DataEntry::SetBinArea( uint8_t *area, bool self )
            Sets the value (non string) of the current Dicom DataEntry
          o void DataEntry::CopyBinArea( uint8_t *area, uint32_t length )
            Inserts the value (non string) into the current DataEntry
          o void DataEntry::SetValue(const uint32_t &id, const double &val)
            Inserts the elementary (non string) value into the current
            (multivaluated) DataEntry, at the id> position.
          o double DataEntry::GetValue(const uint32_t &id) const
            returns, as a double one of the values (when entry is
            multivaluated), identified by its index id.
    * DocEntrySet::GetEntryValue() replaced by DocEntrySet::GetEntryString()


API breaking modifications (since previous version)

    * Stupid difference between gdcm::ValEntry and gdcm::BinEntry removed.
      Only gdcm::DataEntry exist, now.

         ValEntry(DictEntry *e);
         BinEntry(DictEntry *e);
      -->DataEntry *New(uint16_t group,uint16_t elem, VRKey const &vr);

         std::string const &ValEntry::GetValue() const;
         std::string const &BinEntry::GetValue() const;
      -->std::string const &DataEntry::GetString() const;

         uint8_t *BinEntry::GetBinArea();
      -->uint8_t *DataEntry::GetBinArea();

         void ValEntry::SetValue(std::string const &value);
         void BinEntry::SetValue(std::string const &value);   
      -->void DataEntry::SetString(std::string const &value);

         void BinEntry::SetBinArea( uint8_t *area, bool self = true );
      -->void DataEntry::SetBinArea( uint8_t *area, bool self = true );

         void ValEntry::CopyValEntry(uint16_t gr, uint16_t el);
      -->void DataEntry::CopyDataEntry(uint16_t gr, uint16_t el, VRKey const &vr);
          

      Example :

      old way :
              DocEntry *p3 = item2->GetDocEntry(0x0018,0x0050);
              if( !p3 ) return false;
              ContentEntry *entry2 = dynamic_cast(p3);
              std::string thickness = entry2->GetValue();

      new way :
              DocEntry *p3 = item2->GetDocEntry(0x0018,0x0050);
              if( !p3 ) return false;
              DataEntry *entry2 = dynamic_cast(p3);
              std::string thickness = entry2->GetString();


    * Avoid too many source file modifications from gdcm1.2 to gdcm1.3

use :

#define ValEntry                      DataEntry
#define BinEntry                      DataEntry

#define GetEntryValue(g,e)            GetEntryString(g,e)
#define GetEntryForcedAsciiValue(g,e) GetEntryString(g,e)

#define GetValEntry(g,e)              GetDataEntry(g,e)
#define GetBinEntry(g,e)              GetDataEntry(g,e)
#define GetValue()                    GetString()

#define InsertValEntry(v,g,e,vr)      InsertEntryString(v,g,e,vr) // warning mind the VR!
#define InsertBinEntry(b,l,g,e,vr)    InsertEntryBinArea(b,l,g,e,vr)

#define SetValEntry(c,g,e)            SetEntryString(c,g,e)  | !!
#define SetValEntry(c,en)             SetEntryString(c,en)   | !!

#define SetBinEntry(c,l,en)           SetEntryBinArea(c,l,en)   | !!
#define SetBinEntry(c,l,g,e)          SetEntryBinArea(c,l,g,e)  | !!

#define NewValEntry(g,e,vr)           NewDataEntry(g,e,vr)
#define NewBinEntry(g,e,vr)           NewDataEntry(g,e,vr)       


Maybe this is the cause of your problems?
(Mathieu compiles, links and runs without any problem on VC2005)
Jean-Pierre

(I think I have to re-write the "News" part about this.)

> -Greg
>
> 1>Linking...
> 1>AnonymizeDialog.obj : error LNK2019: unresolved external symbol 
> "protected: __thiscall GDCM_NAME_SPACE::File::File(void)" 
> (??0File at GDCM_NAME_SPACE@@IAE at XZ) referenced in function "public: 
> static class GDCM_NAME_SPACE::File * __cdecl 
> GDCM_NAME_SPACE::File::New(void)" (?New at File@GDCM_NAME_SPACE@@SAPAV12 at XZ)
> 1>ImageInformationDialog.obj : error LNK2001: unresolved external 
> symbol "protected: __thiscall GDCM_NAME_SPACE::File::File(void)" 
> (??0File at GDCM_NAME_SPACE@@IAE at XZ)
> 1>LoadFile.obj : error LNK2001: unresolved external symbol "protected: 
> __thiscall GDCM_NAME_SPACE::File::File(void)" 
> (??0File at GDCM_NAME_SPACE@@IAE at XZ)
> 1>AnonymizeDialog.obj : error LNK2019: unresolved external symbol 
> "public: void __thiscall GDCM_NAME_SPACE::File::AnonymizeNoLoad(void)" 
> (?AnonymizeNoLoad at File@GDCM_NAME_SPACE@@QAEXXZ) referenced in function 
> "public: void __thiscall AnonymizeDialog::OnAnonymizeClick(class 
> wxCommandEvent &)" 
> (?OnAnonymizeClick at AnonymizeDialog@@QAEXAAVwxCommandEvent@@@Z)
> ...
> etc
> ...
> 1>LoadFile.obj : error LNK2019: unresolved external symbol "public: 
> float __thiscall GDCM_NAME_SPACE::File::GetYOrigin(void)" 
> (?GetYOrigin at File@GDCM_NAME_SPACE@@QAEMXZ) referenced in function 
> "private: int __thiscall LoadFile::GetFileInfo(class wxString)" 
> (?GetFileInfo at LoadFile@@AAEHVwxString@@@Z)
> 1>LoadFile.obj : error LNK2019: unresolved external symbol "public: 
> float __thiscall GDCM_NAME_SPACE::File::GetZOrigin(void)" 
> (?GetZOrigin at File@GDCM_NAME_SPACE@@QAEMXZ) referenced in function 
> "private: int __thiscall LoadFile::GetFileInfo(class wxString)" 
> (?GetFileInfo at LoadFile@@AAEHVwxString@@@Z)
> 1>.\Release/MIView.exe : fatal error LNK1120: 28 unresolved externals
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Dcmlib mailing list
> Dcmlib at creatis.insa-lyon.fr
> http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib



More information about the Dcmlib mailing list