0

I tried to build a ios app, with cygwin and THEOS

The Tutorial: https://sites.google.com/site/theostutorials/home

After a couple tries, i succeed to get to the end of the tutorial. At the end i only needed to run the command "make package install"

Then i got stuck...

CYGWIN TERMINAL:

ron_000@Laptop-Ron ~/projects/hello3
$ make package install
/home/ron_000/projects/hello3/theos/makefiles/targets/Cygwin/iphone.mk:38: Deplo
ying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.

Making all for application hello3...
Copying resource directories into the application wrapper...
Compiling main.m...
main.m:2:2: error: use of undeclared identifier 'NSAutoreleasePool'
    NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
    ^
main.m:2:21: error: use of undeclared identifier 'p'
    NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
                       ^
main.m:2:27: error: use of undeclared identifier 'NSAutoreleasePool'
    NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init];
                             ^
main.m:3:12: error: implicit declaration of function 'UIApplicationMain' is
  invalid in C99 [-Werror,-Wimplicit-function-decla`enter code here`ration]
    int ret = UIApplicationMain(argc, argv, @"hello3Application", @"...
              ^
main.m:4:3: error: use of undeclared identifier 'p'
    [p drain];
     ^
5 errors generated.
/home/ron_000/projects/hello3/theos/makefiles/instance/rules.mk:96: recipe for t
arget 'obj/main.m.ce2c1a2b.o' failed
make[2]: *** [obj/main.m.ce2c1a2b.o] Error 1
/home/ron_000/projects/hello3/theos/makefiles/instance/application.mk:39: recipe
 for target 'internal-application-all_' failed
make[1]: *** [internal-application-all_] Error 2
/home/ron_000/projects/hello3/theos/makefiles/master/rules.mk:54: recipe for tar
get 'hello3.all.application.variables' failed
make: *** [hello3.all.application.variables] Error 2

Someone knows what i'am doing wrong ?

Thanks for any input,

p.s I hope i used codeblock the right way for this question...

user3676804
  • 31
  • 1
  • 2
  • 1
    This site you're mentioning seems to be quite outdated... first lesson it says : `iPhone 3GS or later with iOS 4 or later (preferably iOS 5).`. Lots of things have changes since iOS 4 ! – Emilie May 26 '14 at 15:38
  • 1
    This is a typical symptom of missing header files. `#import ` and `#import `. – The Paramagnetic Croissant May 26 '14 at 15:39

2 Answers2

1

Could it be that you are compiling with ARC (automatic reference counting)? In this case, the docs say:
If you use Automatic Reference Counting (ARC), you cannot use autorelease pools directly. Instead, you use @autoreleasepool blocks. For example, in place of:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
// Code benefitting from a local autorelease pool.
[pool release];

you would write:

@autoreleasepool {
    // Code benefitting from a local autorelease pool.
}  

It is possible to disable ARC for individual files, see here.

Community
  • 1
  • 1
Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
0

When you see something like undeclared identifier, is time to think about environment setup

Let's focus on UIApplicationMain.

main.m:3:12: error: implicit declaration of function 'UIApplicationMain' is invalid in C99 [-Werror,-Wimplicit-function-declaenter code hereration] int ret = UIApplicationMain(argc, argv, @"hello3Application", @"...

As said in documentation, this class is supposed to be the start of everything for your app, so it must be somewhere in theos setup...

If you dig inside theos symlink from your project

$ cd /to/your/project/dir/theos
$ grep UIKit.h * -C 5

Prefix.pch-#ifdef __OBJC__
Prefix.pch- #import <Foundation/Foundation.h>
Prefix.pch- #if TARGET_IPHONE || TARGET_IPHONE_SIMULATOR
Prefix.pch:     #import <UIKit/UIKit.h>
Prefix.pch- #endif
Prefix.pch-
Prefix.pch- #define CLASS(cls) objc_getClass(#cls)
Prefix.pch-
Prefix.pch- #ifdef DEBUG

You will see that UIKit.h is imported automatically, so that's not the problem.

do a find about that file

$ find -name UIKit.h
./sdks/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h

If that file do exist then, what could be the problem? Let's see in detail that file

$ find -name UIKit.h -exec ls -la \{} \;
-rw-r--r-- 1 root wheel 4454 Jul 19 11:14 ./sdks/iPhoneOS7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h

If your file shows 0 bytes instead that's your problem, no really definition at all!

Extract sdk from xcode.dmg file seems to be ultracomplicated. This answer almost do the trick, but checking files mounted shows 0 bytes for many of them.

Try to get sdk from a real Xcode installation if that's your problem, I bet it is!

Community
  • 1
  • 1
albfan
  • 12,542
  • 4
  • 61
  • 80