undefined reference to

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Tombat
Posts: 2
Joined: Wed, 2011-03-09, 02:33

undefined reference to

#1 Post by Tombat »

Hello,

-I try to install DCMTK 3.6 in code block (10.05)
-I used cmake -> compiler code block:mingw OK
-I gave in code block the paths. h (compiler) and for .cpp (linker) OK
-I did my little program.

Code: Select all

#include "chargementDicom.h"
#include "dcmtk/config/osconfig.h"
#include "dcmtk/dcmdata/dcfilefo.h"
#include "dcmtk/dcmdata/dcsequen.h"
#include "dcmtk/dcmdata/dcdatset.h"

#include <dirent.h>
#include <errno.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>

using namespace std;


  void ChargementDicom::chargement(char* dossier)
  {
        std::vector<string> file_list;
        DIR *pdir;
        struct dirent *pfile;
        pdir = opendir(dossier);
        int ramirez=0;
            while ((pfile = readdir(pdir)) != NULL)
            {
               if(strcmp (pfile->d_name,".")==1 && strcmp (pfile->d_name,"..")==1)
            {
                string flName;
                flName.assign(dossier);
                flName += "/";
                flName += pfile->d_name;
                file_list.push_back(flName);
                ramirez++;
                //DebugLog <<"image "<<ramirez<<" : "<<pfile->d_name<<endl;
           }
            }
            closedir(pdir);

//chargement dicom
    for (int i = 0; i < ramirez; i++)


    {
        DcmFileFormat *fileformat = new DcmFileFormat();

        double largeur;
        const char * largeurchar;
        fileformat->loadFile(file_list[i].c_str(), EXS_Unknown, EGL_noChange, DCM_MaxReadLength,ERM_autoDetect);
        DcmElement *element;
        fileformat->loadAllDataIntoMemory();
        fileformat->getDataset()->findAndGetString (DcmTagKey(0x0028,0x0010),largeurchar,true);
        char * pEnd2;
        largeur = strtod (largeurchar,&pEnd2);
    }
  }
But i have the following message: :cry:

Code: Select all

...
obj\Debug\ChargementDicom.o||In function `_ZN15ChargementDicom10chargementEPc':|
D:\work\data\ProfilGK\ChargementDicom.cc|49|undefined reference to `DcmFileFormat::DcmFileFormat()'|
D:\work\data\ProfilGK\ChargementDicom.cc|56|undefined reference to `DcmFileFormat::getDataset()'|
D:\work\data\ProfilGK\ChargementDicom.cc|56|undefined reference to `DcmItem::findAndGetString(DcmTagKey const&, char const*&, bool)'|
||=== Build finished: 3 errors, 2 warnings ===|
--> in the other topics, i saw that it's a Bad link??

I am an absolute beginner
how I should do to generate links in CB

Thanks in advance.

Tom

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi Tom,

you have to link the corresponding DCMTK libraries to your executable. That is, when linking you have to speficy at least options like "-ldcmdata -loflog -lofstd -L/path/to/DCMTKinstall/lib".

On Windows, adapt the path in the statement to backslashes, e.g. '-L"c:\path\to\DCMTKinstall\lib".

Best regards,
Michael

Post Reply

Who is online

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