Compiling problem - Makefile

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
tigerxa
Posts: 2
Joined: Sun, 2008-01-20, 22:19

Compiling problem - Makefile

#1 Post by tigerxa »

Hello !

I have a problem to compile with dcmtk. I would like to try this test program (This program, that I found on the website, is useless but I try to compile it before to continue.):

Code: Select all

#include <iostream>
#include "dcmtk\dcmimgle\dcmimage.h"

using namespace std;

int main(int argc, char* argv[]) {
    DicomImage *image = new DicomImage("test.dcm");
    if (image != NULL)
    {
       if (image->getStatus() == EIS_Normal)
       {
          if (image->isMonochrome())
          {
             image->setMinMaxWindow();
             Uint8 *pixelData = (Uint8 *)(image->getOutputData(8 /* bits */));
             if (pixelData != NULL)
             {
                /* do something useful with the pixel data */
             }
          }
       } else
       cerr << "Error: cannot load DICOM image (" << DicomImage::getString(image->getStatus()) << ")" << endl;
    }
    delete image;
}

I use this makefile:

Code: Select all

# Makefile for "test"

SHELL = /bin/sh
VPATH = ./config/include
srcdir = .
top_srcdir = ..
configdir = ./config

include ./config/Makefile.def

LOCALINCLUDES = -Iofstd/include -Idcmdata/include -Idcmimgle/include
LIBDIRS = -Lofstd/libsrc -Ldcmdata/libsrc -Ldcmimgle/libsrc
LOCALLIBS = -ldcmimgle -ldcmdata -lofstd $(ZLIBLIBS)
PROGS = test

all: $(PROGS)

test: test.o
	$(CXX) $(CXXFLAGS) $(LDFLAGS) $(LIBDIRS) -o $@ $(LOCALLIBS) $(MATHLIBS) $(LIBS)


test.o: test.cc ./dcmimgle/include/dcmtk/dcmimgle/dcmimage.h
It is compiled in this directory: dcmtk-3.5.4
I use cygwin (UNIX emulator) with Windows XP.
The compiler that I use is the gcc 3.4.4

Each time, I receive an error message like this:

Code: Select all

$ make
c++ -O  -D_REENTRANT -D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
-D_BSD_COMPAT -D_OSF_SOURCE -D_POSIX_C_SOURCE=199506L -Wall   -Lofstd/libsrc -Ld
cmdata/libsrc -Ldcmimgle/libsrc -o test -ldcmimgle -ldcmdata -lofstd -lz -lm -lp
thread  -lwsock32
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../libcygwin.a(libcmain.o):(.text+0xab):
 undefined reference to `_WinMain@16'
collect2: ld returned 1 exit status
make: *** [test] Error 1
I tried a lot of things, but nothing works. Can you explain me my mistake and what I have to do?

Thank you.

tigerxa
Posts: 2
Joined: Sun, 2008-01-20, 22:19

#2 Post by tigerxa »

Nobody can help me?

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 »

Seems to be a Cygwin problem. See this article in the Cygwin FAQ.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest