2

I have a .c and .h file that has to be added in my Swift project. I have created a bridging header and included the .h file. I'm getting Apple Mach-O linker error as follows:

Undefined symbols for architecture x86_64:
  "_smooth", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_tot_samples_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_oldavg_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_newavg_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_newmin_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_count_idle_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_rep_count_var", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_step_cal_incre_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_avgthresh_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_avg_rssdat_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_newmax_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_minavg_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
      _IsStep_rep in rep.o
  "_maxavg_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
      _IsStep_rep in rep.o
  "_accel_dat_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_stepflag_rep", referenced from:
      _IsStep_rep in rep.o
  "_i", referenced from:
      __rep_count_data_passing_2 in rep.o
     (maybe you meant: __TIvC5CTest11AppDelegate6windowGSqCSo8UIWindow_i)
  "_cycle_count_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
  "_avglen_rep", referenced from:
      __rep_count_data_passing_2 in rep.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

What is the issue and how do I fix this? Thank you in advance!

nehaa94
  • 21
  • 2
  • 2
    Check that the "Target Membership" is set in the File inspector of the C file. – Martin R Aug 18 '17 at 11:37
  • Please check this answer https://stackoverflow.com/questions/25820810/undefined-symbols-for-architecture-x86-64-ios-swift?answertab=active#tab-top – arunjos007 Aug 18 '17 at 11:45
  • @MartinR Checked! the appropriate one is selected – nehaa94 Aug 18 '17 at 12:36
  • @arunjos007 same ^ – nehaa94 Aug 18 '17 at 12:37
  • Are you trying to run the code on the simulator? What Xcode version are you using? – Dávid Pásztor Aug 18 '17 at 13:10
  • @DávidPásztor Yes, I'm trying to run the code on the simulator. Xcode Version - 8.3.3 – nehaa94 Aug 18 '17 at 13:16
  • Have you looked at the similar questions? [This](https://stackoverflow.com/questions/29073978/undefined-symbol-for-architecture-x86-64-in-compiling-c-program), [this](https://stackoverflow.com/questions/18600397/undefined-symbols-for-architecture-x86-64-when-linking-c-project) and [this](https://stackoverflow.com/questions/12110184/c-undefined-symbols-for-architecture-x86-64-when-compiling-on-mac-osx-lion) – Dávid Pásztor Aug 18 '17 at 13:20
  • @DávidPásztor yes, I did. didn't seem to work – nehaa94 Aug 18 '17 at 13:24

0 Answers0