← Back to team overview

dolfin team mailing list archive

strange error with swig and forward declaration

 

Hi,

I have a question for the swig experts :) Today I encountered a mysterious (at least for me) compile error with IntersectionOperator class (yes blame me) in connection with the Mesh class.

In the Mesh.h  we find:

[-8<]

#include "MeshTopology.h"
#include "MeshGeometry.h"
#include "MeshData.h"
#include "IntersectionOperator.h"
#include "CellType.h"

namespace dolfin
{

  template <class T> class MeshFunction;
  class Function;
  class BoundaryMesh;
  class XMLMesh;
  class IntersectionOperator;

[->8]

with a forward declaration of the IntersectionOperator although its header file is included. (This is actually just a debris from the first implementation attempt). Strangely this seems to be somehow required, if I remove it I obtain the error

mpic++ -o dolfin/swig/cpp_wrap.os -c -Wall -pipe -ansi -BOOST_UBLAS_NDEBUG -DDEBUG -g -O2 -Werror -DHAS_MPI=1 -DMPICH_IGNORE_CXX_SEEK -DPACKAGE_VERSION=\"0.9.6\" -DHAS_CGAL=1 -DHAS_TRILINOS=1 -DHAS_UMFPACK=1 -DHAS_CHOLMOD=1 -DHAS_PARMETIS=1 -DHAS_LAPACK=1 -DHAS_SLEPC=1 -DHAS_ZLIB=1 -DHAS_MTL4=1 -DHAS_PETSC=1 -DHAS_GMP=1 -DHAS_SCOTCH=1 -fno-strict-aliasing -fno-strict-aliasing -frounding-math -fPIC -I. -I/home/andre/local/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include/libxml2 -I/home/andre/local/include -I/home/andre/local/include -I/usr/include/suitesparse -I/usr/include/suitesparse -I/usr/include -I/home/andre/local -I/home/andre/local/include -I/home/andre/local/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/include -I/home/andre/homebase/software/packages/src/fenics-unstable/mtl4 -I/usr/include -I/home/andre/local/include -I/home/andre/local/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/include -I/usr/include/scotch -I/usr/include/python2.6 -I/usr/include/python2.6 -I/home/andre/local/lib/python2.6/site-packages/numpy/core/include -I/home/andre/local/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include/libxml2 -I/home/andre/local/include -I/home/andre/local/include -I/usr/include/suitesparse -I/usr/include/suitesparse -I/usr/include -I/home/andre/local -I/home/andre/local/include -I/home/andre/local/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/include -I/home/andre/homebase/software/packages/src/fenics-unstable/mtl4 -I/usr/include -I/home/andre/local/include -I/home/andre/local/include -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -I/usr/include -I/usr/include/scotch dolfin/swig/cpp_wrap.cc dolfin/swig/cpp_wrap.cc: In function ‘PyObject* _wrap_Mesh_intersection_operator__SWIG_0(PyObject*, int, PyObject**)’: dolfin/swig/cpp_wrap.cc|45337| error: ‘IntersectionOperator’ was not declared in this scope dolfin/swig/cpp_wrap.cc|45337| error: ‘result’ was not declared in this scope
dolfin/swig/cpp_wrap.cc|45358| error: expected ‘;’ before ‘const’
dolfin/swig/cpp_wrap.cc|45359| error: expected primary-expression before ‘)’ token dolfin/swig/cpp_wrap.cc|45359| error: ‘_result_ref’ was not declared in this scope || dolfin/swig/cpp_wrap.cc: In function ‘PyObject* _wrap_Mesh_intersection_operator__SWIG_1(PyObject*, int, PyObject**)’: dolfin/swig/cpp_wrap.cc|45381| error: ‘IntersectionOperator’ was not declared in this scope dolfin/swig/cpp_wrap.cc|45381| error: ‘result’ was not declared in this scope dolfin/swig/cpp_wrap.cc|45402| error: ‘_result_ref’ was not declared in this scope dolfin/swig/cpp_wrap.cc|45403| error: expected primary-expression before ‘)’ token

Has any of swig experts any idea what goes wrong or how I can make the IntersectionOperator class without forward declaring it?

Andre

	



Follow ups