Bridging C++ and Swift in XCode, what are the right Build Settings? -


when try call functions in c++ implementation file (marked c compatible in header #ifdef __cplusplus extern "c" {} trick), getting error:

"use of unresolved identifier, 'helloworld()'"

i created bridging header adding cpp , header file project , clicking "ok" when asked if wanted create bridging header. #including "test.h" in bridging header, has function declaration inside, reason swift cannot see function.

the weirdest part is, created new project , did exact same procedure, , calling helloworld() works fine, it's existing project i'm trying add cpp file isn't working.

i'm assuming build-settings problem, , must have messed them somewhere along lines, when trying import static c/cpp library (which i've since removed, of build settings changed stayed).

so there build settings should know fix this? or there way reset build settings default (even if means have recreate bridging header bridging header build settings in place)?

thank , help!

james

---edit---

here cpp header:

test.h

here cpp implementation file:

test.cpp

here bridging header:

hawkeye-bridging-header.h

here relevant portion of swift project:

viewdidload in viewcontroller.swift

and here build setting sets bridging header:

relevant build setting

alright - has been resolved. problem bridging header needed realized both regular target , testing target, in existing project because i'm doing unit testing.

i went build settings testing target , added appropriate objective-c bridging header, , worked fine.

hope helps someone!


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -