Could not build module 'Cocoa' in OS X - objective-c

When I am running my app made for OS X everything works as it should. But when I am trying to archive it I got an error Could not build module 'Cocoa' in the line #import <Cocoa/Cocoa.h>
. What could be a possible problem here?
I've checked and Cocoa.framework is included in my application. I also created a new project and tried to archive it and I have the same issue.

Deactivate the "Enables modules (C and objective C) in build settings.

Short answer
Try reinstalling Xcode. The version of Cocoa.framework you're compiling against is screwed up somehow. This will give you a pristine copy, since the version you compile against is inside the Xcode app bundle.
Long answer
For me, anyways, I managed to mangle the contents of NSTableCellView.h.
This was giving me errors like this:
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:21: prefix attribute must be followed by an interface or protocol
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:29: extraneous closing brace ('}')
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:33: unexpected '#' in program
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:37: unexpected '#' in program
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:38: unexpected '#' in program
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:42: unexpected '#' in program
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:46: unexpected '#' in program
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:50: unexpected '#' in program
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTableCellView.h:52: '#end' must appear in an Objective-C context
<unknown>:0: error: /Applications/Xcode6-Beta5.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:13: could not build module 'AppKit'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
<unknown>:0: error: could not build Objective-C module 'Cocoa'
The actual error messages led me to the line in question, where I had overwritten an entire #interface declaration with just the letter x. I just fixed that error, and it compiled again.
If you're not sure what exactly you need to fix, just reinstall Xcode.

You say that you've checked and Cocoa.framework is included in your application, but just make sure that Cocoa.framework is included in "Link Binary With Libraries" section under Build Phases.

Related

Kotlin/Native compilation fails on windows with Java ZipException

I've created a new Kotlin/Native application using IntelliJ Idea and it fails to compile.
I hadn't change anything.
I'm sure it fails at compilation time because it says "Compilation ended with errors"
Stack trace: java.util.zip.ZipException: invalid stored block lengths...

Native linking failed. Please review the build log in Xamarin.iOS Cross platform

I am trying to rebuild my xamarin.iOS project in release mode and i am getting following Errors:
linker command failed with exit code 1 (use -v to see invocation).
error MT5209: Error: warning: ignoring file /Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/obj/iPhone/Release/mtouch-cache/BEMCheckBox.framework/BEMCheckBox, missing required architecture armv7s in file /Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/obj/iPhone/Release/mtouch-cache/BEMCheckBox.framework/BEMCheckBox (4 slices) (MobileApp.iOS) Native linking
/Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: BEMCheckBox. The symbol '_OBJC_CLASS_$_BEMCheckBox' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (MobileApp.iOS)
/Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/MTOUCH: Error MT5211: Native linking failed, undefined Objective-C class: BEMCheckBoxGroup. The symbol '_OBJC_CLASS_$_BEMCheckBoxGroup' could not be found in any of the libraries or frameworks linked with your application. (MT5211) (MobileApp.iOS)
/Users/admin/Desktop/1DMAPP/MobileApp/MobileApp/MobileApp.iOS/MTOUCH: Error MT5202: Native linking failed. Please review the build log. (MT5202) (MobileApp.iOS)
I am using the latest and stable version of packages.
My Link Behavior is "Don't Link"
My project supports all architectures
I want to build and release my iOS app. Native linking error is not allowing me to do this.

Ambiguous resolution module Error RazorPay

After adding react-native-razor-pay dependency, i am getting the following error for ambiguous resolution for react-native .

Build Linux Kernel module with warning i2c_register_board_info undefined

I follow an example in kernel.org to write an i2c driver but unfortunately when i compile i got this warning
WARNING: "i2c_register_board_info" [/home/pi/builddriver/samplei2c/pn535.ko] undefined!
Although compile with 1 warning and no error, I cannot insmod module. this is error when insmod
insmod: ERROR: could not insert module pn535.ko: Invalid module format
My question is how to solve the warning above?, I think it make .ko file to be invalid. Here is my source code on
pastebin
thank for your help!
That is not possible in a kernel module simply because the function i2c_register_board_info is not exported from the kernel source tree to the kernel modules (built using obj-m targets). You can achieve this by building your driver within the kernel source tree using (obj-y targets).

missing ios 5 Headers giving theos errors

So yeah heres the error code when compiling from my ipad via theos
Making all for bundle iNotitweet...
Compiling iNotitweetController.m...
In file included from iNotitweetController.m:2:
/var/theos/include/Twitter/Twitter.h:7:36: error: _ABAddressBookAddRecord.h: No
such file or directory
In file included from /var/theos/include/Twitter/Twitter.h:9,
from iNotitweetController.m:2:
/var/theos/include/Twitter/NSCoding-Protocol.h:8: warning: duplicate declaration for protocol 'NSCoding'
In file included from iNotitweetController.m:2:
/var/theos/include/Twitter/Twitter.h:13: error: cannot find interface declaration
for '_ABAddressBookAddRecord', superclass of 'Twitter'
iNotitweetController.m: In function '-[iNotitweetController composeTweet]':
iNotitweetController.m:48: error: 'TWTweetComposeViewController' undeclared (first
use in this function)
iNotitweetController.m:48: error: (Each undeclared identifier is reported only once
iNotitweetController.m:48: error: for each function it appears in.)
iNotitweetController.m:48: error: 'twtComposer' undeclared (first use in this
function)
iNotitweetController.m:50: error: expected expression before '^' token
make[2]: *** [obj/iNotitweetController.m.o] Error 1
make[1]: *** [internal-bundle-all_] Error 2
make: *** [iNotitweet.all.bundle.variables] Error 2
im using rpetrich's headers and stole the twitter header from from the freemanrepo on github, could anybody please tell me what these errors mean and where i can find _ABAddressBookAddRecord.h im following this code http://pastebin.com/rArx47Bx and this tutorial http://tumblr.leonnears.com/post/17966636490/create-ncwidget-ios.
Those headers are compatibility headers for old versions of iPhoneOS (even before it was iOS), and I do not recommend the continued use of them - there is no real need to support versions below 4.3.3 anyways (or even 5.0.1), as almost everyone is on at least one of those two firmwares. For the most recent headers, either dump your own from the dyldcache (using kennytm's dyld_decache from here), or you can find the SpringBoard headers for iOS 5 here.