views:

123

answers:

2

I am using this OAuth lib: http://github.com/jdg/oauthconsumer

When adding it to my project, it causes over 2000 build errors. These errors are all under the App_Preficx.pch file in the Build Results window.

If you actually click on the errors, they are actually contained in every Foundation Header. I won't list them all, but here are a few examples:

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:236:0 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:236: error: expected identifier or '(' before '@' token

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:238:0 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObjCRuntime.h:238: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:8:0 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:8: error: expected identifier or '(' before '@' token

You can see that Xcode can't seem to link against Foundation or at least can't import headers.

If I remove the OAuth from Xcode, all is well again and compiles.

I can add search paths to my hearts content, but to no avail.

I have added all of the frameworks, libs, and search paths that are required in the docs.

Of all the 2641 errors, none give me any leads to the true issue. There also seem to be no warnings of consequence.

Does anyone have an idea of how I can track down the cause of the problem?

A: 

did you add the Security framework, libxml2.dylib and the search path "$SDKROOT/usr/include/libxml2" to your project like the README says?

jmont
yes, I should have mentioned that I did add all the proper frameworks/libs and headers
Corey Floyd
A: 

Ok found the silly answer.

in the prefix head you may see this:

#ifdef __OBJC__
    #import <Foundation/Foundation.h>
    #import <UIKit/UIKit.h>

#endif

If you add some globals or categories or macros you may be tempted to do this:

    #ifdef __OBJC__
        #import <Foundation/Foundation.h>
        #import <UIKit/UIKit.h>

    #endif

    #import "MacroUtilities.h"
    #import "Global.h"

But that is a bad idea. Reason being is that if you reference Obj-c objects in any of your "global" files, you may be prepending objective-c code to any included c source files. Thus causing the crazy errors.

Instead, keep it real:

    #ifdef __OBJC__
        #import <Foundation/Foundation.h>
        #import <UIKit/UIKit.h>
        #import "MacroUtilities.h"
        #import "Global.h"
    #endif
Corey Floyd
thanks to amrox for the offline help!
Corey Floyd