PrevUpHomeNext

fatal error C1204:Compiler limit:internal structure overflow

Q: I get this error message when compiling a large source file. What can I do?

A: You have two choices:

  1. Upgrade your compiler (preferred)
  2. Break your source file up into multiple translation units.

    my_module.cpp:

    ...
    void more_of_my_module();
    BOOST_PYTHON_MODULE(my_module)
    {
      def("foo", foo);
      def("bar", bar);
      ...
      more_of_my_module();
    }
    

    more_of_my_module.cpp:

    void more_of_my_module()
    {
      def("baz", baz);
      ...
    }
    

    If you find that a class_<...> declaration can't fit in a single source file without triggering the error, you can always pass a reference to the class_ object to a function in another source file, and call some of its member functions (e.g. .def(...)) in the auxilliary source file:

    more_of_my_class.cpp:

    void more_of_my_class(class&lt;my_class&gt;&amp; x)
    {
      x
       .def("baz", baz)
       .add_property("xx", &my_class::get_xx, &my_class::set_xx)
       ;
      ...
    }
    

PrevUpHomeNext