Foundation:nno such file or directory

Discussion in 'iOS Development' started by acca2o, Oct 10, 2009.

  1. acca2o

    acca2o New Member

    Joined:
    Sep 26, 2009
    Messages:
    51
    Likes Received:
    0
    Device:
    2G iPod touch
    I just installed the 3.0 iphone open toolchain in cygwin (xp).
    I wrote my first helloword application:
    a simple Hello.m file where I:
    - import Foundation/NSObject,h and stdio.h
    - define a Hello class interface
    - implement the Hello class
    - wrote a main function that uses the Hello class.

    I tried to compile in this way:

    gcc -Wall Hello.m -lobjc -o hello

    The compiler return me the following message:
    Foundation: no such file or directory

    If I use objc/Object.h instead Foundation/NSObject it works.


    Please help me to overcame the problem?
    Path?
    Bad toolchain?
    wrong gcc command?
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    You're not using F flags to link to the framework. Also, you'll save yourself a lot of trouble by using makefiles.
  3. acca2o

    acca2o New Member

    Joined:
    Sep 26, 2009
    Messages:
    51
    Likes Received:
    0
    Device:
    2G iPod touch
    wow, it sounds interesting...f flag...
    what's the right way to use it?

    Abote the makefile I'm not using it just because trying to understand the problem step by step, but, sure, I'll use it once fixed.

    Thanks a lot
    p
  4. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    I'll put it this way. Here's a sample makefile:
    Code:
    CC=arm-apple-darwin9-gcc
    LD=$(CC)
    CFLAGS=
    LDFLAGS=-F"/System/Library/PrivateFrameworks" -bind_at_load \
    		-lobjc \
    		-framework AudioToolbox \
    		-framework CoreFoundation \
    		-framework CoreGraphics \
    		-framework Foundation \
    		-framework GraphicsServices \
    		-framework IOKit \
    		-framework MobileMusicPlayer \
    		-framework PocketTouch \
    		-framework QuartzCore \
    		-framework UIKit \
    		-multiply_defined suppress
    
    all:	PocketTouch
    
    PocketTouch:	main.o PTApp.o
    	$(LD) $(LDFLAGS) -o $@ $^
    	ldid -S PocketTouch
    
    
    %.o:	%.m
    		$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
    
    clean:
    		rm -f *.o PocketTouch
    
    nice:
    		rm -f *.o
    To use it, all you'd have to type is make PocketTouch

    Otherwise, you'd have to type everything that's in here (more or less) on each line for each source file. Also, linking.

    You *really* want to be using makefiles.



    What the makefile is doing.
    First, you call make PocketTouch (or whatever your app is). It sees that it needs to make a couple of .o files (object files). It does that following the instructions you lay out in the .o section. Once done with the conversions for each source file, it moves on to the linking step. Where it calls arm-apple-darwinr-gcc [Everything in the flags area] to link you object files together to create the binary. Then, it fake signs the application so that the application can actually run without being killed by SpringBoard.
  5. acca2o

    acca2o New Member

    Joined:
    Sep 26, 2009
    Messages:
    51
    Likes Received:
    0
    Device:
    2G iPod touch
    Thanks!!!
    I learned a lot from reading your makefile.
    And now it works.
    I change it a little bit:

    Code:
    CC = arm-apple-darwin9-gcc
    LD = $(CC)
    CFLAGS = -Wall
    LDFLAGS = -F"/toolchain/sys/System/Library/Frameworks" -bind_at_load \
    		-lobjc \
    		-framework Foundation \
    		-multiply_defined suppress
    OBJECTS = main.o
    
    
    all:	application
    
    
    application: $(OBJECTS)
    	$(LD) $(LDFLAGS) $< -o $@
    
    
    %.o:	%.m
    	$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
    
    
    clean:
    	rm -f *.o application
    
    nice:
    	rm -f *.o
    1) I removeded the framework I don't use in my helloword application
    2) I declared a variable for objects to be compiled
    3) I removede Ldid because it giveme back an error. I think it's to sign the applicatione, right? Do I need it with a jailbroken IPOD too? whre can I find it?
    4) the code build the application (no exe extension...right?) but I can't run it in cygwin, why? Have I to run it on IPOD only?
  6. d.devendran

    d.devendran New Member

    Joined:
    Aug 2, 2009
    Messages:
    2
    Likes Received:
    0
    how to add LayerKit frame work, below is my Makefile content

    APPL = WifiInfo
    VERSION = 1.0.5

    IPHONE_ADDRESS=Dave
    DEST = $(HOME)/Desktop
    ZIP = $(APPL)-$(VERSION).zip
    TGZ = $(APPL)-$(VERSION)-src.tgz

    OBJS = main.o aplogger.o apview.o details.o settings.o scanner.o
    DOTH = aplogger.h apview.h details.h scanner.h settings.h

    SDK = /Developer/Platforms/iPhoneOS.platform/Developer
    ARCH = armv6
    SYSROOT = $(SDK)/SDKs/iPhoneOS2.0.sdk


    CC = $(SDK)/usr/bin/arm-apple-darwin9-gcc-4.0.1 \
    -arch $(ARCH) -isysroot $(SYSROOT)

    CFLAGS = -std=c99 -Werror -I$(SDK)/usr/include/gcc/darwin/4.0 \
    -I"/Developer/SDKs/iPhoneOS.sdk/Versions/Current/include" \
    -I"$(SYSROOT)/usr/include" \
    -I"$(DEV)/usr/lib/gcc/arm-apple-darwin9/4.0.1/include" \
    -F"/System/library/Frameworks" \
    -F"$(SYSROOT)/System/library/Frameworks"\
    -F"$(SYSROOT)/System/library/PrivateFrameworks"

    LD=$(CC)
    LDFLAGS=-Wl,-syslibroot,/usr/local/arm-apple-darwin/heavenly\
    -/Developer/SDKs/iPhoneOS.sdk/Versions/Current/include \
    -framework CoreFoundation\
    -framework Foundation\
    -framework UIKit\
    -framework LayerKit\
    -framework CoreGraphics \
    -L"$(SYSROOT)/usr/lib" \
    -F"$(SYSROOT)/System/library/Framework" \
    -F"$(SYSROOT)/include" \
    -lobjc \
    -bind_at_load

    $(APPL): $(OBJS)
    $(LD) $(LDFLAGS) -o $@ $^
    chmod 755 $(APPL)
    cp -p aplogger ./$(APPL).app/$(APPL)
    rm -rf $(DEST)/$(APPL).app
    cp -pR $(APPL).app $(DEST)

    %.o: %.m $(DOTH)
    $(CC) -c $(CFLAGS) $< -o $@


    install: $(APPL)
    scp -r $(APPL).app root@${IPHONE_ADDRESS}:/Applications

    # --------------------------------------------------------------------

    clean:
    rm -f $(APPL) *.o f?
    rm -rf $(ZIP) $(TGZ) $(DEST)/$(APPL).app

    dist:
    make clean
    tar zcvf /tmp/$(TGZ) .
    mv /tmp/$(TGZ) .
    zip $(ZIP) $(APPL).app/*

    backup:
    make clean
    tar zcvf $(DEST)/aplogger.tgz .
    cp $(HOME)/Desktop/aplogger.tgz $(HOME)/backup


    when i compile, i received below error

    ld: framework not found Layerkit
    collect2: ld returned 1 exit status
    make: *** [WifiInfo] Error 1

    please help me

Share This Page