Linker problems on Cygwin (with a twist)

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
furneaux
Posts: 3
Joined: Tue, 2007-05-15, 11:01

Linker problems on Cygwin (with a twist)

#1 Post by furneaux »

Hi,

I am currently having what appears to be a linking issue on Cygwin however it is unlike other problems that have been quoted in that there is only one symbol missing.

I am simply attempting to load a file and extract the value of a tag, the symbols for the file loading functions appear to be resolved (or at least the linker is not complaining about them) but then it is unable to find the symbol for DcmItem::findAndGetOFString.

The following is the linker output followed by the code block causing it:

Code: Select all

$ make
g++ -ggdb   -D_HAVE_CONFIG_H  -I/usr/local/dicom/include -ofileprocessor.o -c fileprocessor.cpp
g++ -ggdb   -D_HAVE_CONFIG_H  -o filelogger   filelogger.o watcher.o netagent.o fileprocessor.o -L /usr/local/dicom/lib -L/usr/lib -lsqlite3 -ldcmnet -ldcmdata -lofstd  -lz  -lpthread  
fileprocessor.o:/cygdrive/d/documents and settings/602354921/My Documents/filelogger/fileprocessor.cpp:53: undefined reference to `DcmItem::findAndGetOFString(DcmTagKey const&, OFString&, unsigned long, int)'
collect2: ld returned 1 exit status
make: *** [filelogger] Error 1

Code: Select all

void FileProcessor::loadFile(char *filename)
{
        OFCondition cond;
        DcmFileFormat file;
        DcmDataset *ds;
        OFString dataValue;

        cond =  file.loadFile(filename);

        if (cond.bad())
        {
                printf("ERR: %s\n", cond.text());
        }

        ds = file.getDataset();
        ds->findAndGetOFString(DcmTag(0x0020, 0x000D), dataValue, 0, false);
        this->uuid = (char *)dataValue.c_str();
}
g++ (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Copyright (C) 2004 Free Software Foundation, Inc.


If more information is required in order to diagnose then please let me know. I have checked the FAQ on linking order dependancies and have played around with the order, the order seen above produces the least unresolved symbols but I guess its still not quite right, any ideas ??

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

It's just a guess but you could try to replace the last parameter (which is in fact of type OFBool) of findAndGetOFString() by "OFFalse" (instead of "false").

furneaux
Posts: 3
Joined: Tue, 2007-05-15, 11:01

#3 Post by furneaux »

Unfortunately that does not seem to have made a difference, any other suggestions??

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

#4 Post by Marco Eichelberg »

Is it possible that you have more than one version of the DCMTK libraries installed and that the linker possibly finds and uses the wrong version of libdcmdata? Other than that, the error is very difficult to explain indeed.

furneaux
Posts: 3
Joined: Tue, 2007-05-15, 11:01

#5 Post by furneaux »

I have managed to track this down now (I think), due to not having -DHAVE_CONFIG_H defined initially there were a number of errors that occured within some of the dcmtk headers, most noteably ofstream.h around which of the string stream versions to use.

As I was not aware of the HAVE_CONFIG_H I altered the header files to define the relevant items to force it to use sstream however I am guessing that I had forgotten something somewhere.

I have now moved over to a propper linux and rebuilt the toolkit from the tar file and things work fine.

How about a page in the docs for the next release that gives details of how to build your own apps e.g. a copy of the FAQ regarding the order of libraries and maybe an example make file or just the arguments required in order to get a good build.

The problems have been worth it now tho as I have a working application thanks to your great software.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest