[Insight-users] Re: Compile problems - Red Hat Enterprise WS-3; c make 2.0.2 ; ITK from CVS ; DICOM parser subdirectory

Fred Nugen noojon at gmail.com
Mon Oct 4 20:14:17 EDT 2004


I had the same problem (see below) as the user who originated this
subject line around early July, and I found a workaround which may 
elicidate the issue.  I also have supporting results using a simple test case.

I am compiling ITK 1.8.0 using CMake 2.0.3.

My solution was not to setenv $CC and $CXX before ccmake'ing.
I am not sure what compilers were used as defaults, and I do not
know how to find out.  I had previously set both to gcc.  (I do not
know what compilers/options were invoked by the command "gcc", and
I do not know how to find out.)  I assume they do something reasonable
(see test case below).

I originally set these values to the best thing I could think of, since I was
instructed to do so in the GettingStarted.txt file.  In retrospect, I should
have known better, but I figured the configuration process would tell me
if there was a problem.

At the bottom is the original error exactly as found, and some info
on the machine/OS used.  Here is are the results of the test case
suggested in the original thread.

---Begin test case output-----
cozumel:~> mkdir foo
cozumel:~> cd foo
cozumel:~/foo> vi foo.c
cozumel:~/foo> cat foo.c
#include <list>
int main(int, char*[])
{
   std::list<int>();
     return 0;
}

cozumel:~/foo> gcc foo.c
foo.c:1:16: list: No such file or directory
foo.c: In function `main':
foo.c:2: error: parameter name omitted
foo.c:2: error: parameter name omitted
foo.c:4: error: parse error before ':' token
cozumel:~/foo> cc foo.c
foo.c:1:16: list: No such file or directory
foo.c: In function `main':
foo.c:2: error: parameter name omitted
foo.c:2: error: parameter name omitted
foo.c:4: error: parse error before ':' token
cozumel:~/foo> c++ foo.c
cozumel:~/foo> g++ foo.c
cozumel:~/foo>
cozumel:~/foo>
cozumel:~/foo>
cozumel:~/foo> gcc --version
gcc (GCC) 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cozumel:~/foo> cc --version
cc (GCC) 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cozumel:~/foo> c++ --version
c++ (GCC) 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cozumel:~/foo> g++ --version
g++ (GCC) 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk)
Copyright (C) 2003 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

cozumel:~/foo>
---End test case output-----

The error I received was as follows.  In receiving
this error, I setenv'd $CC and $CXX both to gcc.

The ccmake settings used:
 BUILD_EXAMPLES                   ON 
 BUILD_SHARED_LIBS                ON
 BUILD_TESTING                    ON
 CMAKE_BACKWARDS_COMPATIBILITY    2.0
 CMAKE_BUILD_TYPE
 CMAKE_INSTALL_PREFIX             /ices/nooj

---Begin output listing-----
[snip]
/homes/ices/nooj/itk-1.8.0/InsightToolkit-1.8.0/build/Utilities/DICOMParser:
building default_target
Building dependencies. cmake.depends...
Building object file DICOMSource.o...
Building object file DICOMBuffer.o...
Building object file DICOMFile.o...
In file included from
/homes/ices/nooj/itk-1.8.0/InsightToolkit-1.8.0/Utilities/DICOMParser/DICOMFile.cxx:29:
/homes/ices/nooj/itk-1.8.0/InsightToolkit-1.8.0/Utilities/DICOMParser/DICOMFile.h:51:
error: syntax error before `&' token
/homes/ices/nooj/itk-1.8.0/InsightToolkit-1.8.0/Utilities/DICOMParser/DICOMFile.cxx:61:
error: syntax error before `&' token
/homes/ices/nooj/itk-1.8.0/InsightToolkit-1.8.0/Utilities/DICOMParser/DICOMFile.cxx:
In member function `bool itkdicomparser::DICOMFile::Open(...)':
/homes/ices/nooj/itk-1.8.0/InsightToolkit-1.8.0/Utilities/DICOMParser/DICOMFile.cxx:66:
error: `filename' undeclared (first use this function)
/homes/ices/nooj/itk-1.8.0/InsightToolkit-1.8.0/Utilities/DICOMParser/DICOMFile.cxx:66:
error: (Each undeclared identifier is reported only once for each
function it appears in.)
make[5]: *** [DICOMFile.o] Error 1
make[4]: *** [default_target] Error 2
make[3]: *** [default_target_DICOMParser] Error 2
make[2]: *** [default_target] Error 2
make[1]: *** [default_target_Utilities] Error 2
make: *** [default_target] Error 2
cozumel:~/itk-1.8.0/InsightToolkit-1.8.0/build>
---End output listing-----

Line 51 of DICOMFile.h reads:
 bool Open(const dicom_stl::string& filename);


I think I have correctly tracked the error down to the cmake check
labelled "does the compiler support std:: ".
The answer seemed to be no (I see the definition
CMAKE_NO_STD_NAMESPACE="1"), and so the code ultimately
defined the macro dicom_stl to be empty in DICOMConfig.h:
#ifdef DICOM_ABOUT_NO_STD_NAMESPACE
 #define dicom_stl
#else
 #define dicom_stl std
#endif


Without setenving the $CC and $CXX variables
 cozumel:~> echo $CC
 CC: Undefined variable.
 cozumel:~> echo $CXX
 CXX: Undefined variable.
the code compiled without errors:

---Begin output listing-----
[snip]
Building shared library
/homes/ices/nooj/itk/InsightToolkit-1.8.0/build/bin/libITKEXPAT.so...
/homes/ices/nooj/itk/InsightToolkit-1.8.0/build/Utilities/DICOMParser:
building default_target
Building dependencies. cmake.depends...
Building object file DICOMSource.o...
Building object file DICOMBuffer.o...
Building object file DICOMFile.o...
Building object file DICOMParser.o...
Building object file DICOMAppHelper.o...
Building shared library
/homes/ices/nooj/itk/InsightToolkit-1.8.0/build/bin/libITKDICOMParser.so...
[snip]
---End output listing-----


The machine is running "Mandrake Linux release 10.0 (Official) for i586"
and "Kernel 2.6.3-14mdk on an i686".

- Fred


More information about the Insight-users mailing list