[vtkusers] Why I can't create a global vtkPolyData instance?

David Doria daviddoria at gmail.com
Mon Apr 30 21:29:23 EDT 2012


On Mon, Apr 30, 2012 at 9:42 AM, Wenlong Wang <scc.wwl at gmail.com> wrote:

> It is a regular console application. It goes like
>
> #include <vtkxxx.h>
> //.............
> //---------- Include headers -----------------
>
> vtkPolyData* polydata = vtkPolyData::New();    // here pops the error
> //............
>
> void main()
> {
>      //.........................................
> }
>


New() is a function. You can't call a function outside of a scope like you
have done there in c++. For example, this doesn't compile either:

void MyFunction() {}

MyFunction(); // You can't do this

int main()
{
  return 0;
}

My compiler says "error: expected constructor, destructor, or type
conversion before ‘;’ token" - I would expect yours says something more
than "access conflict" as well.

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120430/e1f6de2a/attachment.htm>


More information about the vtkusers mailing list