简体   繁体   中英

Bridging objective-c library in swift project does not work

In my swift project in need to use snmp++ project ( https://github.com/Zchander/mobile-snmp-plusplus ). The snmp++ project is written in c++ and then objective-c wrapper is created for functions.

The project generates libMobileSNMP_PP.a file which i include in my swift project and then create a bridging header and in the bridging header inport "XISMobile_SNMP_PP.h".

Also included .mm and .h files in the swift project as shown in the attached image example1

在此输入图像描述

at compile it gives "could not reference bridging file in the app".

I refered link Can I mix Swift with C++? Like the Objective - C .mm files but still issue exist.

I even tried steps as given in example as shown https://github.com/foundry/OpenCVSwiftStitch/tree/master/SwiftStitch but no success.

Please tell where i'm doing or missing any step.

Did you tell your Swift Compiler about your Objective-C Bridging Header?

Swift Bridging Header

If not, go to your project and click your target. Go to build settings and down tords the bottom you will see the Swift compiler as shown in the image. Add your header file there and recompile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM