3

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

enter image description here

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.

Community
  • 1
  • 1
sia
  • 1,872
  • 1
  • 23
  • 54
  • Hey how did you solved this issue? i'm having a similar problem while connected this library with my swift project and i'm badly stuck. – shahtaj khalid Aug 02 '18 at 16:08

1 Answers1

1

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.

mKane
  • 932
  • 13
  • 30
  • even after adding the bridging header file in Build settings... same issue exists. – sia Aug 05 '15 at 00:27
  • It is allowing you to use the objc code in your .swift, it just wont compile and run? – mKane Aug 05 '15 at 13:10