[Insight-users] Re : issue with the file: cstddef - Qt and ITK and g++
Luis Ibanez
luis.ibanez at kitware.com
Wed Apr 28 00:06:30 EDT 2010
Hi Merlin,
Thanks for the additional information.
Just to clarify:
1) Are you observing this problem both in
MinGW and in your Ubuntu installation ?
2) Do you observe this problem when you
use ITK without Qt ?
For example, if you reconfigure ITK
to turn ON BUILD_EXAMPLES and
BUILD_TESTING, and then build the
ITK project.... do you get any compilation
errors (when using the original code).
3) Do you have anywhere in your code an
statement:
using namespace std;
??
Please let us know,
Thanks
Luis
--------------------------------------------------------------------------
On Tue, Apr 27, 2010 at 3:59 AM, Merlin Lenchanteur <tibouroxane at yahoo.fr>wrote:
> Hello,
>
> First, thanks for your reply and your point of view.
>
> To reply to your question : " What is the value of this variable in your
> MinGW build ?" it is 1. And Yes, I do have a "cstddef" file in the include
> directory of Gcc under my MinGWs (gcc 3.4.5 and 4.4), and also in my Ubuntu
> 9.10 distribution in the directory you mentioned.
>
> With my workaround (renaming file Utilities \ itksys \ cstddef to
> Utilities \ itksys \ cstddef.h) I was able to move on in my development of
> my application in all platforms. So I did not take any more time to look
> further into this problem.
> The thing that worries me the most is the fact to have to do this 'patch'
> every time I'll use a new version of itk or when I will
> recompiled/reinstalled it. I'll try one of those days to look into this
> problem again. Even though I'm quite confident with my path and include
> directories in my development configurations.
>
> Thanks,
>
>
> ------------------------------
> *De :* Luis Ibanez <luis.ibanez at kitware.com>
> *À :* Merlin Lenchanteur <tibouroxane at yahoo.fr>
>
> *Cc :* insight-users at itk.org
> *Envoyé le :* Jeu 22 avril 2010, 16 h 34 min 17 s
> *Objet :* Re: [Insight-users] issue with the file: cstddef - Qt and ITK
> and g++
>
>
> 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/20100428/e95f863f/attachment.htm>
More information about the Insight-users
mailing list