Main Content

Errors Parsing Header Files on macOS

The clibgen.generateLibraryDefinition and clibgen.buildInterface functions fail when parsing some header files on the macOS platform.

Suppose that you have two header files. Header file simple1.hpp includes a standard header, such as vector.

#ifndef SIMPLE1_HPP 
#define SIMPLE1_HPP 

#include <vector> 

// class definitions
// functions
#endif

Header file simple2.hpp includes simple1.hpp.

#include "simple1.hpp"

// class definitions based on simple1.hpp content
// other functionality

This call to clibgen.generateLibraryDefinition generates errors parsing the header file on macOS.

clibgen.generateLibraryDefinition(["simple1.hpp","simple2.hpp"],"InterfaceName","simple")

To include this content in the library, create a wrapper header file with the contents of simple1.hpp and simple2.hpp. For example, create wrapsimple.hpp with these statements:

#ifndef SIMPLE1_HPP 
#define SIMPLE1_HPP 

#include <vector> 

// class definitions
// functions
#endif

// Start of simple2.hpp content. Do not add the include simple1.hpp statement.

// class definitions based on simple1.hpp content
// other functionality

Create the library definition definesimple.m by using the wrapper header file.

clibgen.generateLibraryDefinition("wrapsimple.hpp","InterfaceName","simple")

See Also

|