[Insight-users] issue with the file: cstddef - Qt and ITK and g++
Luis Ibanez
luis.ibanez at kitware.com
Thu Apr 22 10:34:17 EDT 2010
Hi Merlin,
Thanks for your detailed email and for sharing this findings.
Looking at the content of the cstddef might be enlightening:
-------------------------------------------------------------------
#ifndef itksys_cstddef
#define itksys_cstddef
#include <itksys/Configure.hxx>
/* Avoid warnings in MSVC standard headers. */
#ifdef _MSC_VER
# pragma warning (push, 1)
# pragma warning (disable: 4702)
# pragma warning (disable: 4786)
#endif
/* Include the real header. */
#if itksys_CXX_HAS_CSTDDEF
# include <cstddef>
#else
# include <stddef.h>
#endif
#ifdef _MSC_VER
# pragma warning(pop)
#endif
#endif
-------------------------------------------------------
The primary suspect for the conflict that you are observing
is the variable:
itksys_CXX_HAS_CSTDDEF
this variable get set during the configuration process
via try-compiles.
and decides whether this file is going to redirect
the include to:
# include <cstddef>
or to
# include <stddef.h>
The value is set in the file
Configure.hxx
(in the binary directory Utilities/itksys)
In a Visual Studio 9 configuration, this variable is set to
Configure.hxx: #define itksys_CXX_HAS_CSTDDEF 1
in a Ubuntu Linux 9.10 gcc 4.4 configuration, it gets set to
Configure.hxx: #define itksys_CXX_HAS_CSTDDEF 1
So, the question is:
What is the value of this variable
in your MinGW build ?
and... do you have a "cstddef" file in the include directory
of Gcc under MinGW ?
As a reference,
In Ubuntu Linux, with gcc 4.4 this file is at:
/usr/include/c++/4.4/cstddef
Please let us know what you find,
Thanks
Luis
------------------------------------------------
On Tue, Apr 20, 2010 at 3:00 PM, Merlin Lenchanteur <tibouroxane at yahoo.fr>wrote:
> Hello,
>
> I just wanted to point out what could seems a very small detail at first,
> but in the end, I spent quite a few hours (even days) to find it out.
>
> My environments are the following:
> First:
> Win32 - XP Pro
> Qt 4.6.2 (opensource edition)
> ITK 3.12 and 3.16
> Mingw 3.4.5 and 4.4.0
>
> Second:
> Ubuntu 9.10 (Karmic Koala) 32 bits
> Qt 4.6.2 (opensource edition)
> ITK 3.18
> compiler: gnu 4.4.1
>
> On both configuration: CMake v2.8
>
> I wanted to use Qt and ITK together in my applications and with mingw 3.4.5
> (and now 4.4) for Win32 or gnu 4.4.1 for Linux. But when compiling, I had
> weird errors about std::size_t not found. Typical errors when we are missing
> includes or dependencies.
> I tried with Win32 using microsoft visual studio, but there was no problem.
> It only appears with the g++ compiler.
>
>
> Step to reproduce the problem:
> Prerequisite: Qt and ITK correctly set up.
> Write a simple main.cpp program which include qapplication.h (for example).
> Create a makefile which contains Qt and all ITK dependencies and includes (
> don't forget Utilities\itksys - it's there that the problem lies).
> Run make --> error
> If you remove all the ITK dependencies and includes, the make succeeds (but
> then we can not use ITK :(!!).
>
>
> How I solved it:
> The problem is in the install directory of ITK.
> To build and install ITK, I used CMake. In the settings, I remove threading
> (because I don't need it). The CMake part and the build of ITK runs
> smoothly.
> Then I run "make install". So far, so good; everything is installed in my
> install directory (I thought).
>
> In fact, the filename cstddef does not contain the '.h' extension in the
> directory
> "install \ include \ InsightToolkit \ Utilities \ itksys".
> I changed this (renamed cstddef to cstddef.h), and then, everything went
> well for me from that point on.
>
> Is there any particular reason for this file not to have the .h extension
> as all its friends next to it in the directory? or is this a bug ?
>
> I spent quite a long time to find this out, by first rechecking my code
> (before going to a simple study case), redownloading and recompiling Qt and
> ITK, changing compilers version and so on.
>
> If my current fix (the fact to add the extension '.h' to the cstddef
> filename) is not recommended, please, let me know, but if you could help me
> fix my problem then, I'll take any suggestions.
>
> Anyway, my proposed fix might help somebody.
>
> good day,
>
>
>
> _____________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20100422/5ee341be/attachment.htm>
More information about the Insight-users
mailing list