3

When creating a Cocoa Touch Static Library with XCode4, the .a file in the Products groups appear red and building doesnt fix this. Then, when adding this project to another project in the same workspace with Build Phases/Link Binary With Libraries, the build fails at linking. Any pointers?

Edit: It looks like a problem with anything I build with XCode4, because no matter what project I build, the content of Products appears in red.

sharvey
  • 7,635
  • 7
  • 48
  • 66
  • Are you sure you have chosen the correct scheme when you build? I just created a static lib project in Xcode4 a few days ago and it worked just fine. – Firoze Lafeer Mar 28 '11 at 00:26
  • @Firoze Lafeer, there's only one scheme created. – sharvey Mar 28 '11 at 01:59
  • can you explain me how to create static libraries using xcode4.0.I currently using xcode4.0 and there is no good online help for creating static library using xcode4.0. its urgent to me. thanks in advance. emailId : naveens@rapidvaluesolutions.com – Naveen Shan Apr 11 '11 at 08:01

4 Answers4

1

XCODE 4.x builds .a files in respective directory - below is description of release build for simulator and iphone

There was no modification to project settings during the output

/Users/userName/Library/Developer/Xcode/DerivedData/projectName-uniqueIdentifier/Build/Products/Release-iphoneos

/Users/userName/Library/Developer/Xcode/DerivedData/projectName-uniqueIdentifier/Build/Products/Release-iphonesimulator

replace below values -

userName = change userName to current user
projectName-uinqueIdentifier = project name followed by unique identifier
Tisho
  • 8,320
  • 6
  • 44
  • 52
anish
  • 11
  • 1
1

I experienced the same bug in Xcode 4. Try building the project for the device. Once I did that once, the build product turned black and I could then build for the simulator or device without issues. You may also need to re-add the libraries to your dependent project.

cduhn
  • 17,818
  • 4
  • 49
  • 65
0

When the product name is in red, that indicates it wasn't built successfully. Check the "issues" pane to see what the problem was. The triangle & exclamation point icon will bring it up, as shown here:

enter image description here

(Sorry, Grab captured the tool tip, but not the mouse cursor - I hope you can see the icon I mean anyway.)

Sherm Pendley
  • 13,556
  • 3
  • 45
  • 57
  • Thanks for the answer, but there's no issues visible. In fact, the unit test can be run successfully. The problem is easily reproducible by creating a brand new project and building it. – sharvey Mar 27 '11 at 23:45
  • I believe you can set the cursor 'captured' in Grab's Preferences. – Nicolas Miari Jul 17 '12 at 07:23
0

Looking at the comments, I'm a little confused. It sounds like you have successfully built the library, but maybe you haven't got a static build yet? Because that's what you'll want if you're trying to link it to another project. If that's the case, then you need to run the scheme that includes the static library target first. Then it will appear, and then you can link it to another project.

Alec Sloman
  • 287
  • 1
  • 9
  • To me it seems like it's a bug with XCode4, because no matter what type of project I build, the content of Products appears in red. – sharvey Mar 30 '11 at 23:16
  • I haven't been having that problem in general. What library are you trying to build? I could give it a shot. – Alec Sloman Mar 31 '11 at 05:41
  • absolutely any library or project at all, just creating a brand new Cocoa Touch Static Library shows the results in red. – sharvey Apr 03 '11 at 16:31
  • I've been experiencing something similar with Xcode4, I'm getting red libraries that I know are being built successfully. – Goles Apr 21 '11 at 11:07