[Insight-users] ITK with Xcode

Boris Shabash bshabash at hotmail.com
Sun Apr 11 23:54:46 EDT 2010


Hi Luis

I got the same error when I simply created a new C++ command utility tool in
xcode and tried to compile while including ITK files.

HOWEVER, it seems to compile now once I changed the name of ITK's "time.h"
file into "ITKtime.h" and recompiled the entire Xcode project that was
produced with Cmake. Now both my Obj-C++ and C++ projects seem to compile
fine. But I wonder, changing the file name from "time.h" to "ITKtime.h"
should have definitely introduced errors, but it didn't. Which files use
ITK's "time.h" file?

Boris

Luis Ibanez wrote:
> 
> Hi Boris,
> 
> Thanks for sharing your findings.
> 
> More that "time.h" we probably should track
> includes for "ctime", since that is the file
> where the error message is reported:
> 
> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:66: error:
> '::clock_t' has not been declared
> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:68: error:
> '::tm'
> has not been declared
> 
> 
> The "ctime" header is included in ITK from
> the following files:
> 
> Utilities/vxl/vcl/vcl_ctime.h:# include <ctime>
> Utilities/vxl/vcl/iso/vcl_ctime.h:#include <ctime>
> 
> 
> I'm not familiar with the iPhoneOS development environment....
> so I'm just wondering if it doesn't get to be recognized by one
> of the manual configurations that VXL has predefined.
> 
> If  you open the file
> 
>              Insight/Utilities/vxl/vcl/vcl_ctime.h
> 
> You will see the following code:
> 
> #ifndef vcl_ctime_h_
> #define vcl_ctime_h_
> /*
>   fsm
> */
> 
> #include "vcl_compiler.h"
> 
> // Purpose: provide access to the <time.h> standard C header.
> 
> #if !VCL_CXX_HAS_HEADER_CTIME || defined(VCL_METRO_WERKS)
> # include <time.h>
> # define vcl_generic_ctime_STD /* */
> # include "generic/vcl_ctime.h"
> #elif defined(VCL_VC60)
> # include <ctime>
> # define vcl_generic_ctime_STD /* */
> # include "generic/vcl_ctime.h"
> #else
> # include "iso/vcl_ctime.h"
> #endif
> 
> // ??
> #ifndef VCL_WIN32
> #include <sys/times.h>
> #endif
> 
> #endif // vcl_ctime_h_
> 
> 
> Do you recognize in this code something that would be
> defined differently between MacOS and the iPhoneOS ?
> 
> You may also find interesting content in the file:
> 
> /home/ibanez/src/Insight/Utilities/vxl/vcl/vcl_compiler.h
> 
> 
>     Please let us know,
> 
> 
>            Thanks
> 
> 
>                   Luis
> 
> 
> -----------------------------------------------------------------------
> On Sat, Apr 10, 2010 at 9:33 AM, Luis Ibanez
> <luis.ibanez at kitware.com>wrote:
> 
>>
>> Hi Boris,
>>
>> It would seem that "clock_t" is not defined in the
>> expected location in your platform.
>>
>> Please try the following example first
>> (independently of ITK):
>>
>>
>> (taken from):
>> http://www.cplusplus.com/reference/clibrary/ctime/clock/
>>
>> /* clock example: countdown */
>> #include <stdio.h>
>> #include <time.h>
>>
>> void wait ( int seconds )
>> {
>>   clock_t endwait;
>>   endwait = clock () + seconds * CLOCKS_PER_SEC ;
>>   while (clock() < endwait) {}
>>
>> }
>>
>> int main ()
>> {
>>   int n;
>>   printf ("Starting countdown...\n");
>>   for (n=10; n>0; n--)
>>   {
>>     printf ("%d\n",n);
>>     wait (1);
>>
>>   }
>>   printf ("FIRE!!!\n");
>>   return 0;
>> }
>>
>>
>>
>> And let us know if it can be compiled in your platform.
>>
>>
>>      Thanks
>>
>>
>>           Luis
>>
>>
>>
>> ---------------------------------------------------------------------------------------------------
>>
>> On Fri, Apr 9, 2010 at 10:24 PM, Boris Shabash
>> <bshabash at hotmail.com>wrote:
>>
>>>
>>> Hello everyone
>>>
>>> I am currently trying to compile ITK on the iphoneOS and for that I need
>>> to
>>> be working in the Xcode environment.
>>>
>>> I've downloaded ITK and Cmake and created an Xcode project for ITK using
>>> Cmake.
>>> Now for the purpose of testing I've created a new C++ command line
>>> utility
>>> tool and included all the paths to find the libraries and headers.
>>>
>>> However, when I try to compile the command line utility tool I get the
>>> following error from including the ITK paths:
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:66: error:
>>> '::clock_t' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:68: error:
>>> '::tm'
>>> has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:70: error:
>>> '::clock' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:71: error:
>>> '::difftime' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:72: error:
>>> '::mktime' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:73: error:
>>> '::time' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:74: error:
>>> '::asctime' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:75: error:
>>> '::ctime' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:76: error:
>>> '::gmtime' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:77: error:
>>> '::localtime' has not been declared
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/ctime:78: error:
>>> '::strftime' has not been declared
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:
>>> In member function '_InIter std::time_get<_CharT,
>>> _InIter>::_M_extract_via_format(_InIter, _InIter, std::ios_base&,
>>> std::_Ios_Iostate&, tm*, const _CharT*) const':
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1794:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1801:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1809:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1816:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1828:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1835:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1838:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1850:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1855:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1863:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1867:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1887:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1923:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:1931:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:
>>> In member function 'virtual _InIter std::time_get<_CharT,
>>> _InIter>::do_get_weekday(_InIter, _InIter, std::ios_base&,
>>> std::_Ios_Iostate&, tm*) const':
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2157:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:
>>> In member function 'virtual _InIter std::time_get<_CharT,
>>> _InIter>::do_get_monthname(_InIter, _InIter, std::ios_base&,
>>> std::_Ios_Iostate&, tm*) const':
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2203:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:
>>> In member function 'virtual _InIter std::time_get<_CharT,
>>> _InIter>::do_get_year(_InIter, _InIter, std::ios_base&,
>>> std::_Ios_Iostate&,
>>> tm*) const':
>>>
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/bits/locale_facets.tcc:2230:
>>> error: invalid use of undefined type 'struct tm'
>>> /Developer/SDKs/MacOSX10.5.sdk/usr/include/wchar.h:152: error: forward
>>> declaration of 'struct tm'
>>>
>>> What is going on?
>>> --
>>> View this message in context:
>>> http://old.nabble.com/ITK-with-Xcode-tp28199033p28199033.html
>>> Sent from the ITK - Users mailing list archive at Nabble.com.
>>>
>>> _____________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>>
>>
>>
> 
> _____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.html
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
> 
> 

-- 
View this message in context: http://old.nabble.com/ITK-with-Xcode-tp28199033p28213619.html
Sent from the ITK - Users mailing list archive at Nabble.com.



More information about the Insight-users mailing list