oksunp / vvopensource

Automatically exported from code.google.com/p/vvopensource
0 stars 0 forks source link

#if IPHONE Compiler Directive Not Recognized #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.  Build static library
2.  Link against XCode project
3.  Compile project

What is the expected output? What do you see instead?
Successfully compiled project.  The #if IPHONE compiler directive is not being 
recognized, therefore I am getting error messages such as "Cocoa/Cocoa.h" when 
compiling for iPhone.

What version of the product are you using? On what operating system?
r85 with XCode 3.2.4 on OS X 10.6.4

Please provide any additional information below.
I've read replacing IPHONE with TARGET_OS_IPHONE fixes the problem.  I don't 
know.  I just removed the conditional compiler directives and references to OS 
X headers to compile successfully.

Original issue reported on code.google.com by jameson.proctor@gmail.com on 27 Oct 2010 at 11:11

GoogleCodeExporter commented 8 years ago
Sorry...  In response to the "What do you see instead?" question, I meant to 
write - I am getting error messages such as "Cocoa/Cocoa.h:  No such file or 
directory."

Thanks,
Jameson

Original comment by jameson.proctor@gmail.com on 28 Oct 2010 at 2:17

GoogleCodeExporter commented 8 years ago
first of all, let's try to eliminate the obvious: did you try updating your 
repository and making sure you don't have any local modifications?

"The #if IPHONE compiler directive is not being recognized...I just removed the 
conditional compiler directives and references to OS X headers to compile 
successfully."

are you telling me that when you check out a copy of this project, it doesn't 
compile without modification?  if you are, i just can't reproduce that- i'm 
using xcode 3.2.4 on a completely clean install of 10.6.4 (installed 
specifically for testing this issue), and when i check out this project and 
click the "compile" button everything works.

the IPHONE define should be getting passed directly to the compiler via the 
"other c flags" section of the build prefs.  i've checked all the static libs, 
and they all have the requisite flag (-DIPHONE), so i'm quite curious as to 
what's causing this...

Original comment by raycut...@gmail.com on 28 Oct 2010 at 11:13

GoogleCodeExporter commented 8 years ago
1.  I have updated the repository to r90.  There are no local modifications.

2.  As far as the VVOpenSource XCode project is concerned - when I make 
Build/Install VVOSC iPhone SDK the active target, set the configuration to 
Release, and build the target.  The project compiles successfully with no 
warnings or errors.  It is after linking the the VVBasics and VVOSC SDKs to my 
own XCode iPad project that I run into errors.  All errors are related to the 
#if IPHONE/#else conditional statements and, more specifically,  the references 
to OS X headers and classes (i.e. Cocoa.h or NSColor, NSMenu, etc.).  So yes, I 
am telling you that I cannot compile my own XCode project against the VVBasics 
and VVOSC SDKs without modifying the header files.  Once modified, my project 
compiles and the SDKs provide the expected functionality.

3.  I took a look at the libs and can confirm that flags are there as well.

I'm attaching a screenshot of the Build Results with error messages.

Original comment by jameson.proctor@gmail.com on 29 Oct 2010 at 12:08

Attachments:

GoogleCodeExporter commented 8 years ago
hmm....this is just a guess, but are you including any of the specific header 
files by calling something like this:

#import <VVOSC/OSCManager.h>

instead of this:

#import <VVOSC/VVOSC.h>

...i ask because the very first line of VVOSC.h in your compiled SDK 
(~/Library/SDKs/VVOSC/iphonesimulator.sdk/usr/local/include/VVOSC/VVOSC.h) 
#defines IPHONE as 1- perhaps you're getting that error because you #imported a 
specific file, and the IPHONE define got skipped?

if that's not it, then would it be possible for you to send me a simple sample 
project that reproduces your problem (i don't need to see the source for your 
project, just a quickie example app with the same linking error)?  i tried 
making a new iOS project as per the instructions on the homepage and i'm not 
getting any errors when compiling against the SDK, so to go further i'd really 
like to duplicate your error...

Original comment by raycut...@gmail.com on 29 Oct 2010 at 2:03

GoogleCodeExporter commented 8 years ago
I once had this very same problem. To resolve, in my project, under project 
settings / other c flags, I put:

-DIPHONE=1

Perhaps they should be changed to something like:

#ifdef TARGET_OS_IPHONE

See also:

http://stackoverflow.com/questions/3742525/target-os-iphone-and-applicationtests
http://stackoverflow.com/questions/458304/how-can-i-programmatically-determine-i
f-my-app-is-running-in-the-iphone-simulator

Original comment by cgfallha...@gmail.com on 2 Nov 2010 at 12:42

GoogleCodeExporter commented 8 years ago
The problem was with importing specific header files (i.e. #import 
<VVOSC/OSCManager.h>).  Once I changed this line to #import <VVOSC/VVOSC.h> all 
complier errors were corrected.  I am now up and running with an unmodified 
copy of the current repository.  Thanks, and sorry for leaving this open for a 
few days.  I've been slammed with work.

Original comment by jameson.proctor@gmail.com on 2 Nov 2010 at 3:51

GoogleCodeExporter commented 8 years ago

Original comment by raycut...@gmail.com on 2 Jan 2011 at 7:59