0

I'm using iOS Universal framework template.

I created framework and added them as sub project to another project. And added framework binaries to the project.

in my framework there is some constants

const float kToolbarHeight = 45;

And when i'm trying to Build my Project and included Framework for iphone simulator (i386), there are linker errors:

ld: 14 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

but when i build it for device - there is not any linker errors.

I'm tried to exclude subProject (my framework) from Project, and and keep only binaries, but there is not any effect.

I'm trying to change architectures in targets to the i386, and to the $(VALID_ARCHS), as described in that issue, but there is not any effect.

How can I build framework for iOS simulator, what settings of target should I use?

Update: The problem was resolved when I defined my constants as extern in header file.

// MyView.h

extern const float kToolbarHeight;

// MyView.m

const float kToolbarHeight = 45;

But why? What difference in simulator and arm builds?

BergP
  • 3,453
  • 4
  • 33
  • 58
  • yup that is how you do it... go ahead and write it as an answer an accept it, it may help someone in the future. – Grady Player Apr 27 '13 at 14:24
  • ok @GradyPlayer , but, I do not understand, why it worked while I do not wrote "extern" in ARM builds? – BergP Apr 28 '13 at 06:25
  • different linker... different wanings... ? it really doesn't help to wonder way the wrong thing sometimes works... – Grady Player Apr 28 '13 at 14:29

1 Answers1

2

The problem was resolved when I defined my constants as extern in header file.

// MyView.h

extern const float kToolbarHeight;

// MyView.m

const float kToolbarHeight = 45;

about extern

Community
  • 1
  • 1
BergP
  • 3,453
  • 4
  • 33
  • 58