DEV Community

David Goyes
David Goyes

Posted on

Activando interoperabilidad con C++ en proyecto con extern C

Al activar interoperabilidad con C++ con Vuforia, aparecen los siguientes errores:

Import of C++ module 'std_stdint_h' appears within extern "C" language linkage specification
Import of C++ module '_DarwinFoundation1.TargetConditionals' appears within extern "C" language linkage specification
Could not build Objective-C module 'VuforiaEngine'

Los headers de Vuforia tienen cosas así:

#ifdef __cplusplus
extern "C" {
#endif

#include <TargetConditionals.h>
#include <stdint.h>

...
#ifdef __cplusplus
}
#endif
Enter fullscreen mode Exit fullscreen mode

Cuando Swift+C++ Interop está activado, intenta importar <stdint.h> y <TargetConditionals.h> como módulos C++ (std_stdint_h, _DarwinFoundation1.TargetConditionals). Sin embargo, tratar de importar un módulo C++ dentro de extern "C" provoca un error de Clang.

Básicamente Swift lo interpreta como: “¿cómo diablos voy a importar C++ dentro de un contenedor que explícitamente dice no C++?”.

Top comments (0)