Summary:
Error I'm experiencing is as title states. I'm encountering a Reference to '' is ambiguous error. I've been unable to determine what the problem, whether if my import structure is set up incorrectly and the headers are somehow included multiple times or whatnot.
Due to request and requirements, I'm currently trying to build a single view iOS application using Objective-C and C while importing a custom pure C SDK. This is my first time using C in an iOS application, let alone including a whole SDK, so I'm not 100% sure if the process I'm doing this is correct, but have been able to resolve errors as I've been compiling.
SDK files are being included via a prefix.h which is imported into the single viewcontroller's header. I also read somewhere to use .pch instead of .h, but I'm not able to figure out how to do so given the requirements of this project...
Errors:
Reference to 'E_EXTERNAL_DEVICE_TYPE__CARD_ENTRY_DEVICE' is ambiguous.
- "In file included from .../ViewController.m" -"In file included from .../ViewController.h"
- "In file included from .../prefix.h"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_TYPE__CARD_ENTRY_DEVICE'"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_TYPE__CARD_ENTRY_DEVICE'"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_TYPE__CARD_ENTRY_DEVICE'"
Reference to 'E_EXTERNAL_DEVICE_CONNECT_TYPE__BLUETOOTH' is ambiguous.
- "In file included from .../ViewController.m"
- "In file included from .../ViewController.h"
- "In file included from .../prefix.h"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_CONNECT_TYPE__BLUETOOTH'"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_CONNECT_TYPE__BLUETOOTH'"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_CONNECT_TYPE__BLUETOOTH'"
Reference to 'E_EXTERNAL_DEVICE_TYPE__PRINTER' is ambiguous.
- "In file included from .../ViewController.m"
- "In file included from .../ViewController.h"
- "In file included from .../prefix.h"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_TYPE__PRINTER'"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_TYPE__PRINTER'"
- "Candidate found by name lookup is'_E_EXTERNAL_DEVICE_TYPE__PRINTER'"
// Device.c
...
// this and other similiar lines of code that throws the error
if((deviceType == E_EXTERNAL_DEVICE_TYPE__CARD_ENTRY_DEVICE) && E_EXTERNAL_DEVICE_CONNECT_TYPE__BLUETOOTH) {
CODE x = E_EXTERNAL_DEVICE_TYPE__PRINTER;
}
Solutions attempted
The strange part is, at one point I was able to build and run parts of the project by interatively uncommenting lines and debugging lines of code as I went along starting with SDKInitialize. But for some unknown reason, I'm now getting this error even though I've commented the SDKInitialize() in ViewController.m such that it's just an empty ViewController doing nothing.
I've also tried reverting back an older git version where the project could build fine, but it's still encountering the same error, which possibly leads me to believe this may be related to the XCode IDE or some kind of configuration settings...
- cleaned project
- deleted everything inside '~/Library/Developer/Xcode/DerivedData/ModuleCache/'
- clean once more
- build project
Already checked
- Reference to 'X' is ambiguous
- Reference to 'CMTime' is ambiguous
- Reference to enum is ambiguous objective-c
- Xcode: "Reference to NSString is ambiguous"
Build Settings
I have tried setting setting always_search_user_paths = No;
Always Search User Paths = Yes;
Header Search Paths[$(PROJECT_DIR)/.../.../.../SDK/Common] = recursive;
Header Search Paths[$(PROJECT_DIR)/.../.../.../SDK/Core] = recursive;
Header Search Paths[$(PROJECT_DIR)/.../.../.../GenericAppRoot] = non-recursive;
... etc
FYI app.xcodeproj exists inside ___/GenericAppRoot/Devices/iOS
File Structure
Common.h
//located in $(PROJECT_DIR)/.../.../.../SDK/Common
//Common.h
#ifndef __DTISDK_COMMON_H__
#define __DTISDK_COMMON_H__
//--------
// SDK Includes
//--------
//...
//--------------
// External Device Types
//--------------
typedef enum _E_EXTERNAL_DEVICE_TYPE
{
E_EXTERNAL_DEVICE_TYPE__PRINTER = 1,
E_EXTERNAL_DEVICE_TYPE__CARD_ENTRY_DEVICE = 2,
E_EXTERNAL_DEVICE_TYPE__PIN_ENTRY_DEVICE = 3,
} E_EXTERNAL_DEVICE_TYPE;
//...
typedef enum _E_EXTERNAL_DEVICE_CONNECTION_TYPE
{
E_EXTERNAL_DEVICE_CONNECT_TYPE__AUDIO = 1,
E_EXTERNAL_DEVICE_CONNECT_TYPE__BLUETOOTH = 2,
} E_EXTERNAL_DEVICE_CONNECTION_TYPE;
//...
#endif //__DTISDK_COMMON_H__
prefix.h
#ifndef prefix_h
#define prefix_h
#include "File.h"
#include "File.c"
#include "System.h"
#include "System.c"
#include "Common.h"
... etc
ViewController.h
#import <UIKit/UIKit.h>
#import "prefix.h"
@interface ViewController: UIViewController
@end
ViewController.m
#import "ViewController.h"
@interface ViewController()
@end
@implementation ViewController
- (void) viewDidLoad {
[super viewDidLoad];
// initialization callback from one of the SDK classes
SDKInitialize();
}
@end