- Home /
Question by
Ben 15 · Jan 14, 2011 at 10:43 AM ·
iphonepluginsobjective-c
Attempt at using plugins for iphone
Following what I have read on the Unity site I've been attempting to implement an objective c plugin for an iPhone app. However with even the most basic examples I try the Xcode project will not build without errors.
With:
#import <UIKit/UIKit.h>
extern "C" { float TestPluginFunction() { return 5.0F; } }
and
using UnityEngine; using System.Collections; using System.Runtime.InteropServices;
public class PluginTest : MonoBehaviour {
[DllImport ("__Internal")]
private static extern float TestPluginFunction();
void Awake(){
if (Application.platform != RuntimePlatform.OSXEditor){
print( TestPluginFunction());
}
else{
print("blah");
}
}
}
I get the error:
Undefined symbols: "_TestPluginFunction", referenced from: _TestPluginFunction$non_lazy_ptr in RegisterMonoModules.o (maybe you meant: _TestPluginFunction$non_lazy_ptr) ld: symbol(s) not found collect2: ld returned 1 exit status
It is probably something obvious - can anyone see what the problem is?
Comment