[vtkusers] Trying to compile simple program using VTK

Абакумов Андрей scratchboom at gmail.com
Mon Nov 2 18:02:37 EST 2009


Hello All!

I try to compile this helloworld program with VTK header

#include <iostream>
#include "vtkStructuredGridWriter.h"

using namespace std;

int main(){
    cout << "Hello VTK!!!" << endl;
    return 0;
}


I compile this program on Ubuntu Linux 9.04 using g++:
g++ /src/main.cpp -I/home/andrew/archives/vtk-5.4.2
-I/home/andrew/archives/vtk-5.4.2/IO
-I/home/andrew/archives/vtk-5.4.2/Filtering
-I/home/andrew/archives/vtk-5.4.2/Common
-I/home/andrew/archives/vtk-5.4.2/vtkstd
-I/home/andrew/archives/vtk-5.4.2/Utilities
-I/home/andrew/archives/vtk-5.4.2/Views -o fdtd.exe

but get these errors:

 In file included from /usr/include/c++/4.3/backward/strstream:51,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIOStream.h:112,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkSystemIncludes.h:40,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIndent.h:24,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObjectBase.h:43,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObject.h:41,
                   from
/home/andrew/archives/vtk-5.4.2/Filtering/vtkAlgorithm.h:32,
                   from /home/andrew/archives/vtk-5.4.2/IO/vtkWriter.h:31,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkDataWriter.h:29,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkStructuredGridWriter.h:26,
                   from /home/andrew/workspace/FDTD/src/main.cpp:2:
  /usr/include/c++/4.3/backward/backward_warning.h:33:2: warning: #warning
This file includes at least one deprecated or antiquated header which may be
removed without further notice at a future date. Please use a non-deprecated
interface with equivalent functionality instead. For a listing of
replacement headers and interfaces, consult the file backward_warning.h. To
disable this warning use -Wno-deprecated.
  In file included from /usr/include/c++/4.3/ios:48,
                   from /usr/include/c++/4.3/ostream:45,
                   from /usr/include/c++/4.3/iostream:45,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIOStream.h:35,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkSystemIncludes.h:40,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIndent.h:24,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObjectBase.h:43,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObject.h:41,
                   from
/home/andrew/archives/vtk-5.4.2/Filtering/vtkAlgorithm.h:32,
                   from /home/andrew/archives/vtk-5.4.2/IO/vtkWriter.h:31,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkDataWriter.h:29,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkStructuredGridWriter.h:26,
                   from /home/andrew/workspace/FDTD/src/main.cpp:2:
  /usr/include/c++/4.3/bits/ios_base.h:210: error: expected class-name
before ‘{’ token
  /usr/include/c++/4.3/bits/ios_base.h:226: error: field ‘_M_msg’ has
incomplete type
  In file included from /usr/include/c++/4.3/bits/basic_ios.h:44,
                   from /usr/include/c++/4.3/ios:50,
                   from /usr/include/c++/4.3/ostream:45,
                   from /usr/include/c++/4.3/iostream:45,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIOStream.h:35,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkSystemIncludes.h:40,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIndent.h:24,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObjectBase.h:43,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObject.h:41,
                   from
/home/andrew/archives/vtk-5.4.2/Filtering/vtkAlgorithm.h:32,
                   from /home/andrew/archives/vtk-5.4.2/IO/vtkWriter.h:31,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkDataWriter.h:29,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkStructuredGridWriter.h:26,
                   from /home/andrew/workspace/FDTD/src/main.cpp:2:
  /usr/include/c++/4.3/bits/locale_facets.h: In member function ‘std::string
std::numpunct<_CharT>::grouping() const’:
  /usr/include/c++/4.3/bits/locale_facets.h:1795: error: return type ‘struct
std::string’ is incomplete
  /usr/include/c++/4.3/bits/locale_facets.h: In member function ‘virtual
std::string std::numpunct<_CharT>::do_grouping() const’:
  /usr/include/c++/4.3/bits/locale_facets.h:1863: error: return type ‘struct
std::string’ is incomplete
  In file included from /usr/include/c++/4.3/bits/locale_facets.h:2635,
                   from /usr/include/c++/4.3/bits/basic_ios.h:44,
                   from /usr/include/c++/4.3/ios:50,
                   from /usr/include/c++/4.3/ostream:45,
                   from /usr/include/c++/4.3/iostream:45,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIOStream.h:35,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkSystemIncludes.h:40,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIndent.h:24,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObjectBase.h:43,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObject.h:41,
                   from
/home/andrew/archives/vtk-5.4.2/Filtering/vtkAlgorithm.h:32,
                   from /home/andrew/archives/vtk-5.4.2/IO/vtkWriter.h:31,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkDataWriter.h:29,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkStructuredGridWriter.h:26,
                   from /home/andrew/workspace/FDTD/src/main.cpp:2:
  /usr/include/c++/4.3/bits/locale_facets.tcc: In member function ‘_InIter
std::num_get<_CharT, _InIter>::_M_extract_float(_InIter, _InIter,
std::ios_base&, std::_Ios_Iostate&, std::string&) const’:
  /usr/include/c++/4.3/bits/locale_facets.tcc:195: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:266: error: invalid use of
incomplete type ‘struct std::basic_string<char, std::char_traits<char>,
std::allocator<char> >’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::basic_string<char, std::char_traits<char>, std::allocator<char> >’
  /usr/include/c++/4.3/bits/locale_facets.tcc:280: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:303: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:339: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc: In member function ‘_InIter
std::num_get<_CharT, _InIter>::_M_extract_int(_InIter, _InIter,
std::ios_base&, std::_Ios_Iostate&, _ValueT&) const’:
  /usr/include/c++/4.3/bits/locale_facets.tcc:455: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:539: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:551: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc: In member function ‘virtual
_InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter,
std::ios_base&, std::_Ios_Iostate&, float&) const’:
  /usr/include/c++/4.3/bits/locale_facets.tcc:683: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:685: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc: In member function ‘virtual
_InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter,
std::ios_base&, std::_Ios_Iostate&, double&) const’:
  /usr/include/c++/4.3/bits/locale_facets.tcc:696: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:698: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc: In member function ‘virtual
_InIter std::num_get<_CharT, _InIter>::do_get(_InIter, _InIter,
std::ios_base&, std::_Ios_Iostate&, long double&) const’:
  /usr/include/c++/4.3/bits/locale_facets.tcc:724: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  /usr/include/c++/4.3/bits/locale_facets.tcc:726: error: invalid use of
incomplete type ‘struct std::string’
  /usr/include/c++/4.3/bits/stringfwd.h:56: error: declaration of ‘struct
std::string’
  In file included from /usr/include/c++/4.3/iostream:45,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIOStream.h:35,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkSystemIncludes.h:40,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkIndent.h:24,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObjectBase.h:43,
                   from
/home/andrew/archives/vtk-5.4.2/Common/vtkObject.h:41,
                   from
/home/andrew/archives/vtk-5.4.2/Filtering/vtkAlgorithm.h:32,
                   from /home/andrew/archives/vtk-5.4.2/IO/vtkWriter.h:31,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkDataWriter.h:29,
                   from
/home/andrew/archives/vtk-5.4.2/IO/vtkStructuredGridWriter.h:26,
                   from /home/andrew/workspace/FDTD/src/main.cpp:2:
  /usr/include/c++/4.3/ostream: In destructor ‘std::basic_ostream<_CharT,
_Traits>::sentry::~sentry()’:
  /usr/include/c++/4.3/ostream:412: error: there are no arguments to
‘uncaught_exception’ that depend on a template parameter, so a declaration
of ‘uncaught_exception’ must be available
  /usr/include/c++/4.3/ostream:412: error: (if you use ‘-fpermissive’, G++
will accept your code, but allowing the use of an undeclared name is
deprecated)

BUILD FAILED


Is there any ideas, what's wrong?

Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20091103/3aa6ccad/attachment.htm>


More information about the vtkusers mailing list