[Insight-developers] Compilation problems with itkIntTypes.h

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Feb 11 19:32:33 EST 2010


I would suggest the easiest thing would be to change them to:

using std::vector;
using std::list;
etc...

Based on the object or declaration needed. I am not sure that is the correct syntax above but it's likely close.

Brad


On Feb 11, 2010, at 6:30 PM, Luis Ibanez wrote:

> Brad, Tom,
> 
> Yeap, the statements
> 
>       "using namespace std"
> 
> look like a good hint to follow.
> 
> 
> We have indeed many of them in
> InsightApplications.               :-/
> 
> 
> They shouldn't be there....
> 
> 
> I'll do a pass to clean them up.
> 
> 
>   Thanks
> 
> 
>      Luis
> 
> 
> ----------------------------------------------------
> On Thu, Feb 11, 2010 at 2:26 PM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
>> I have seen this issue with some compilers when they dump an entire namespace into the global such as:
>> 
>> using namespace std;
>> 
>> or
>> 
>> using namespace itk;
>> 
>> While the c++ standard does specify how to resolve these issues in an intelligent fashion. I believed that the code int itkIntTypes should work. Unfortunately all compilers don't follow the same intelligent behavior.
>> 
>> 
>> One possible solution may be to change the following type of decelerating in itkIntTypes.h:
>> 
>> from:
>> 
>> typedef ::int8_t int8_t;
>> 
>> to:
>> 
>> namespace using ::int8_t;
>> 
>> 
>> I thought the first would be the least problematic. There is also another possibility. I think the non standard header <cstdint>, may place these typedefs into the std namespace, this may help to resolve some issues with non-compliant compilers, by using one of the prior statements with the std namespace qualifier.
>> 
>> I am not sure what the best approach is going to be, nor if there is one that will work for all systems.
>> 
>> 
>> Brad
>> 
>> 
>> On Feb 11, 2010, at 2:07 PM, Luis Ibanez wrote:
>> 
>>> Hi Brad,
>>> 
>>> 
>>> The builds of InsightApplications are having problems
>>> with some types declared in itkIntTypes.h.
>>> 
>>> 
>>> In particular:
>>> 
>>> 
>>> http://www.cdash.org/CDash/viewBuildError.php?buildid=537491
>>> 
>>> .../Insight/Code/Common/itkIntTypes.h:117: error:
>>> typedef intmax_t itk::intmax_t
>>> 
>>> (this is a Linux 32bits machine).
>>> 
>>> 
>>> and
>>> 
>>> 
>>> 
>>> http://www.cdash.org/CDash/viewBuildError.php?buildid=537473
>>> 
>>> 86>C:\Program Files (x86)\Microsoft Visual Studio
>>> 8\VC\include\xlocnum(590) : error C2872: 'uintptr_t' : ambiguous
>>> symbol
>>> 
>>> 86>        could be 'C:\Program Files (x86)\Microsoft Visual Studio
>>> 8\VC\include\vadefs.h(50) : unsigned __int64 uintptr_t'
>>> 86>        or 'd:\cygwin\home\ibanez\dashboards\src\insight\code\common\itkIntTypes.h(166)
>>> : itk::uintptr_t'
>>> 
>>> (this is a Windows 64bits machine).
>>> 
>>> 
>>> Do you have any advice on how these
>>> compilation errors should be resolved ?
>>> 
>>> 
>>> 
>>>    Thanks
>>> 
>>> 
>>>         Luis
>> 
>> 



More information about the Insight-developers mailing list