[vtkusers] Error in an online VTK-example (SOLVED)

Bill Lorensen bill.lorensen at gmail.com
Sat Jan 9 22:55:44 EST 2010


You would need to do something like this in the example code:

#if VTK_MAJOR_VERSION>5 || (VTK_MAJOR_VERSION==5 && VTK_MINOR_VERSION>4)
#include <vtkstd/limits>
#else
#include <limits>
#endif

This illustrates one of the problems encountered when distributing
code that supports a changing API.

Bill

On Sat, Jan 9, 2010 at 5:59 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Tue, Jan 5, 2010 at 10:59 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>> On Mon, Dec 28, 2009 at 12:11 PM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>> Yes.
>>>
>>> On Mon, Dec 28, 2009 at 12:04 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
>>>> On Mon, Dec 28, 2009 at 12:01 PM, Benjamin Frigan
>>>> <frigan at itap.physik.uni-stuttgart.de> wrote:
>>>>> Ok, it worked. Thanks a lot!
>>>>>
>>>>> Regards,
>>>>> Ben
>>>>>
>>>>>
>>>>>
>>>>> On Mon, Dec 28, 2009 at 11:55:49AM -0500, Bill Lorensen wrote:
>>>>>> Ben,
>>>>>>
>>>>>> Let's keep the discussion on the list.
>>>>>>
>>>>>> Bill
>>>>>>
>>>>>> On Mon, Dec 28, 2009 at 11:55 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>>>> > Ahhh... limits was added after the 5.4 release. Try
>>>>>> >
>>>>>> > #include <limits>
>>>>>> > instead of
>>>>>> > #include <vtkstd/limits>
>>>>>> >
>>>>>> >
>>>>>> > On Mon, Dec 28, 2009 at 11:50 AM, Benjamin Frigan
>>>>>> > <frigan at itap.physik.uni-stuttgart.de> wrote:
>>>>>> >> It doesn't look like that. This is what I have
>>>>>> >>
>>>>>> >> algorithm  exception   iterator  map     new      queue  stack      string   vector
>>>>>> >> deque      functional  list      memory  numeric  set    stdexcept  utility
>>>>>> >>
>>>>>> >>
>>>>>> >> Best,
>>>>>> >> Ben
>>>>>> >>
>>>>>> >>
>>>>>> >> On Mon, Dec 28, 2009 at 11:39:43AM -0500, Bill Lorensen wrote:
>>>>>> >>> You should have vtkstd/limits. It should be in the VTK binary
>>>>>> >>> tree/vtkstd/limiits
>>>>>> >>>
>>>>>> >>> Can you do an "ls" on the VTK binary tree/vtkstd/ and report the results?
>>>>>> >>>
>>>>>> >>> Bill
>>>>>> >>>
>>>>>> >>> On Mon, Dec 28, 2009 at 11:35 AM, Benjamin Frigan
>>>>>> >>> <frigan at itap.physik.uni-stuttgart.de> wrote:
>>>>>> >>> > For all,
>>>>>> >>> > I'm using opensuse 11.1, gcc, VTK5.4.2 (built from source) and I used the CMakeLists.txt that was on the page.
>>>>>> >>> >
>>>>>> >>> >
>>>>>> >>> >
>>>>>> >>> >
>>>>>> >>> > On Mon, Dec 28, 2009 at 11:31:32AM -0500, Bill Lorensen wrote:
>>>>>> >>> >> Also, did you build VTK from the source? or is this an installed VTK?
>>>>>> >>> >>
>>>>>> >>> >> On Mon, Dec 28, 2009 at 11:25 AM, Bill Lorensen <bill.lorensen at gmail.com> wrote:
>>>>>> >>> >> > What version of VTK are you using?
>>>>>> >>> >> >
>>>>>> >>> >> > Did you use the CMakeLists.txt file on that same page? or your own?
>>>>>> >>> >> >
>>>>>> >>> >> > On Mon, Dec 28, 2009 at 11:08 AM, Benjamin Frigan
>>>>>> >>> >> > <frigan at itap.physik.uni-stuttgart.de> wrote:
>>>>>> >>> >> >> Hi,
>>>>>> >>> >> >> I was looking at the following example "Color a mesh by height" on
>>>>>> >>> >> >> http://www.vtk.org/Wiki/VTK_Examples_Color_a_mesh_by_height
>>>>>> >>> >> >> With 'cmake' I don't get any errors. But after that with 'make' I get:
>>>>>> >>> >> >>
>>>>>> >>> >> >> [100%] Building CXX object CMakeFiles/ColoredElevationMap.dir/ColoredElevationMap.cxx.o
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx:10:25: error: vtkstd/limits: No such
>>>>>> >>> >> >> file or directory
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx: In function ‘int main(int, char**)’:
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx:38: error: ‘numeric_limits’ is not a
>>>>>> >>> >> >> member of ‘std’
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx:38: error: expected primary-expression
>>>>>> >>> >> >> before ‘double’
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx:38: error: expected ‘,’ or ‘;’ before
>>>>>> >>> >> >> ‘double’
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx:39: error: ‘numeric_limits’ is not a
>>>>>> >>> >> >> member of ‘std’
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx:39: error: expected primary-expression
>>>>>> >>> >> >> before ‘double’
>>>>>> >>> >> >> /home/benjamin/Desktop/VTK_EXAMPLES_WEB/ColoredElevationMap.cxx:39: error: expected ‘,’ or ‘;’ before
>>>>>> >>> >> >> ‘double’
>>>>>> >>> >> >> make[2]: *** [CMakeFiles/ColoredElevationMap.dir/ColoredElevationMap.cxx.o] Error 1
>>>>>> >>> >> >> make[1]: *** [CMakeFiles/ColoredElevationMap.dir/all] Error 2
>>>>>> >>> >> >> make: *** [all] Error 2
>>>>>> >>> >> >>
>>>>>> >>> >> >>
>>>>>> >>> >> >> Can anyone help me with that?
>>>>>> >>> >> >>
>>>>>> >>> >> >> Best,
>>>>>> >>> >> >> Ben
>>>>>> >>> >> >>
>>>>>> >>> >> >>
>>>>>> >>> >> >> _______________________________________________
>>>>>> >>> >> >> Powered by www.kitware.com
>>>>>> >>> >> >>
>>>>>> >>> >> >> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>>>>> >>> >> >>
>>>>>> >>> >> >> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>>>>> >>> >> >>
>>>>>> >>> >> >> Follow this link to subscribe/unsubscribe:
>>>>>> >>> >> >> http://www.vtk.org/mailman/listinfo/vtkusers
>>>>>> >>> >> >>
>>>>>> >>> >> >
>>>>>> >>> >
>>>>
>>>> Can vtkstd/limits be changed to check the version and simply try to
>>>> #include <limits> if it is < 5.4?
>>>>
>>>> Thanks,
>>>>
>>>> David
>>>> _______________________________________________
>>
>>
>> I looked into adding something like:
>>
>> stringstream ss;
>> ss << vtkVersion::GetVTKSourceVersion();
>> double version;
>> ss >> version;
>>
>> if(version < 5.4)
>> {
>>  // do something different
>> }
>>
>> However, I found that the 'limits' file is actually in my bin directory:
>> ..../bin/VTK/vtkstd/limits
>>
>> How does this file end up in the bin directory? Where would I make a
>> change like this in the source directory so that the change gets
>> copied into the bin directory (I'm guessing at build time?)?
>>
>> Thanks,
>>
>> David
>>
>
> I guess this doesn't really make sense... if we have to change
> something because limits doesn't exist in a < 5.4 install, the change
> won't exist either, as it is only in cvs head...
>
> Right?
>
> David
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list