Just starting out using OF and firstly wanted to say what a great site this is: the instructions on how to get the examples working were brilliant - worked first time. Good stuff!
Ok, hope I’m posting this question in the right part of the forum…
I’m trying to get my OF app on the iPhone to send out OSC messages. I compiled and ran the TouchAndAccelExample code with no problems out of the box. But I noticed that ofxOsc was not included in of_preRelease_v0061_iPhone_FAT-pre3/addons. So I copied it over from of_preRelease_v0061_osxSL_FAT/addons, added the ofxOsc to the Xcode TouchAndAccelExample project and added
#include "ofxOsc.h"
into TouchAndAccelExample’s testApp.h.
Now, when I build TouchAndAccelExample, I get an error…
of_preRelease_v0061_iPhone_FAT-pre3/apps/iPhoneSpecificExamples/TouchAndAccelExample/../../../addons/ofxOsc/libs/oscpack/include/osc/OscTypes.h:245: error: expected unqualified-id before '__null'
is it ok to use that ofxOsc addon folder in the iPhone project? Or is there another version I should use?
Otherwise, anything else I should check to get it working? Should I expect it to work “out of the box” or do I need to do some porting work to get ofxOsc working on iPhone?
But then when I add code to the main app to send OSC messages, I get lots of linker errors that it can’t find the oscpack library functions…
Even though in XCode, if I show info on the target, the osc.a from oscpack is there in the Linked Library list.
Also in the target info, I checked the build settings and the osc.a path had automatically already been added to the Library Search Paths setting. But there were no osc paths in the Header Search Paths field. So I added…
Hey, try removing the oscpack.a file from your xcode project, and just adding the source of oscpack which google can tell you where to get it from. In the source of oscpack, all the headers are included as #include “ip/xxxxx.h” etc with folder name, so you will need to add the header paths to header search paths. It seems you’ve already done that (make sure you do it for ‘all configurations’ and not just ‘debug’ or ‘release’). Hopefully that should do the trick.
Your original linking problem was because the oscpack.a that comes with ofxOsc is a pre-compiled library for mac osx running on desktop. So it links when linking for the simulator (which runs on intel x86 processor), but doesn’t when target is the device (cos linker can’t find the compiled lib for arm).
You need to comment out the line with ‘Nil’ because in objective C ‘Nil’ is already #defined (as null). You are probably including ofxOsc.h in an objective-c file (a .mm) so the declarations are clashing. I’m not sure how Nil is used in ofxOsc (i’m guessing as a null object), but it seems to work without that line so all is cool. Actually the clash is only in the OscTypes.h where it is declared as an extern, so other .cpp’s can use it like a global variable - which it turns out isn’t necessary since commenting the line out works. In OscTypes.cpp it is still declared as Nil and used within that source file without any problems since that is not an ObjC source file and the #define doesn’t exist in there.
I just had same issue with you and followed the solution Memo mentioned. I commented a line and remove oscpack.a file. Then I have no idea next step of adding the source of oscpack … Could you share how you did?
Hey, try removing the oscpack.a file from your xcode project, and just adding the source of oscpack which google can tell you where to get it from. In the source of oscpack, all the headers are included as #include “ip/xxxxx.h” etc with folder name, so you will need to add the header paths to header search paths. It seems you’ve already done that (make sure you do it for ‘all configurations’ and not just ‘debug’ or ‘release’). Hopefully that should do the trick.
Yeah I’m a bit stuck on this too. I tried adding the ofxOsc/src folder to the src folder in my xcode project, but still 21 linker errors.
Actually this isn’t the first time I have spent hours trying to get around a lib that wasn’t compiled for arm7. I’m sure I could just get in there and recompile it myself, but I don’t know enough about doing that.
It would be great if someone could recompile the whole of the addons libraries to support arm7!!
OK, I managed it. Basically, drag the source from the new downloaded oscpack into the relevant subfolders of in the ofxOsc addon folder (oscpack/include/ip & oscpack/include/osc). You’ll need to keep the folder structure the way it is in the original ofxOsc folder, not the way the oscpack dnload is structured. Delete the win32 folder - you only want posix .cpp files. Drag the ofxOsc folder into your addons folder in xcode.
Add the header search paths as mentioned previously in this thread.
I think that was it… :
Rob