xiaobailong24
10/26/2021, 9:11 AM#ifndef socket_swift_bridge_h
#define socket_swift_bridge_h
// <https://github.com/socketio/socket.io-client-swift>
@import SocketIO;
#endif /* socket_swift_bridge_h */
then get error:
Exception in thread "main" java.lang.Error: /xxx/socket_swift_bridge.h:14:1: error: use of '@import' when modules are disabled
at org.jetbrains.kotlin.native.interop.indexer.UtilsKt.ensureNoCompileErrors(Utils.kt:152)
at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.indexDeclarations(Indexer.kt:1003)
at org.jetbrains.kotlin.native.interop.indexer.IndexerKt.buildNativeIndexImpl(Indexer.kt:992)
at org.jetbrains.kotlin.native.interop.indexer.NativeIndexKt.buildNativeIndex(NativeIndex.kt:91)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.processCLib(main.kt:268)
at org.jetbrains.kotlin.native.interop.gen.jvm.MainKt.interop(main.kt:76)
at org.jetbrains.kotlin.cli.utilities.InteropCompilerKt.invokeInterop(InteropCompiler.kt:45)
at org.jetbrains.kotlin.cli.utilities.MainKt.mainImpl(main.kt:38)
at org.jetbrains.kotlin.cli.utilities.MainKt.main(main.kt:60)
so, how to solve it? thxViacheslav Kormushkin
10/26/2021, 9:22 AM@import SocketIO
should be replaced with something umbrella header import, something like #import <SocketIO/SocketIO.h>
xiaobailong24
10/26/2021, 9:28 AM#import <Socket.io-client-swift-umbrella.h>
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double SocketIOVersionNumber;
FOUNDATION_EXPORT const unsigned char SocketIOVersionString[];
, then get another error:
error: use of undeclared identifier 'SocketIOStatusNotConnected'
xiaobailong24
10/26/2021, 9:33 AMSocketIOStatusNotConnected
Viacheslav Kormushkin
10/26/2021, 10:20 AM#import <SocketIO/SocketIO-Swift.h>
will work, give it a tryxiaobailong24
10/26/2021, 11:32 AMxiaobailong24
10/26/2021, 11:39 AM//#import <SocketIO/SocketIO-Swift.h>
//#import <Socket.io-client-swift/Socket.io-client-swift-Swift.h>
//#import <SocketIOClientSwift/SocketIOClientSwift-Swift.h>
//#import <Socket.io-client-swift/SocketIOClientSwift-Swift.h>