Frage

Ich versuche, einige Codes für den iPhone-Simulator zu kompilieren, aber diese Störung erhalten:

    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -O3 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -Os  -O3 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -Os -x objective-c -I../../include  -c version.c      
    In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:29,
                     from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:14,
                     from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:80,
                     from version.c:11:
    /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:166: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
    /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:196: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
    /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:228: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
    /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:257: error: expected declaration specifiers or ‘...’ before ‘SecPadding’
    make: *** [version.o] Error 1

Wenn ich jedoch für die eigentliche iphone kompilieren, es funktioniert:

    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -O3 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk  -arch armv6  -Os  -O3 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk  -arch armv6  -Os -x objective-c -I../../include  -c version.c      

Dieses Problem tritt mit einer Datei so einfach wie nur einschließlich Foundation.h mit keinem anderen Code:

#import <Foundation/Foundation.h>

Alle Ideen, was ist das? Das seltsame ist, dass ich würde dies erwarten sowohl für iphone zum Scheitern verurteilt und den Simulator.

EDIT: FYI, ich bin nicht XCode verwenden. Dies ist ein großer, Multi-Plattform-Projekt mit Makefiles. Die Befehle, die Sie oben sehen, wurden aus dem Makefile ausgegeben.

War es hilfreich?

Lösung

sah ich die gleiche Sache. Die Lösung ist eine -miphoneos-Version-min = 3.0 Compiler-Direktive hinzuzufügen.

Andere Tipps

Das Problem tritt nur auf, wenn Sie SDK 3.0 mit dem iPhone-Simulator. Mit SDK 2.0 (mit gcc 4.0) kompiliert. Dies scheint zu sein, was XCode standardmäßig verwendet.

Es ist sehr seltsam, dass dieses Problem nur für den Simulator und nicht für das iPhone selbst. Auch seltsam, dass gcc4.2 nicht mit Simulator sdk kompilieren 2.0-- Sie haben gcc4.0 zu verwenden.

Für die Neugierigen, schrieb ich eine Make-Datei, die das Problem veranschaulicht:

IPHONE_GCC_VER    = 4.0
IPHONE_SDK_VER    = 3.0
IPHONE_DEV_PATH   = /Developer/Platforms/iPhoneOS.platform/Developer
IPHONE_SDK        = $(IPHONE_DEV_PATH)/SDKs/iPhoneOS$(IPHONE_SDK_VER).sdk 
IPHONE_GCC        = $(IPHONE_DEV_PATH)/usr/bin/gcc-$(IPHONE_GCC_VER)

SIMULATOR_GCC_VER = 4.0
SIMULATOR_SDK_VER = 2.0
SIMULATOR_DEV_PATH= /Developer/Platforms/iPhoneSimulator.platform/Developer
SIMULATOR_SDK     = $(SIMULATOR_DEV_PATH)/SDKs/iPhoneSimulator$(SIMULATOR_SDK_VER).sdk
SIMULATOR_GCC     = $(SIMULATOR_DEV_PATH)/usr/bin/gcc-$(SIMULATOR_GCC_VER)

TEST_FILE=/tmp/test.m

all: info make-test-file
    $(IPHONE_GCC)    -isysroot $(IPHONE_SDK)    -arch armv6 -c $(TEST_FILE) 
    $(SIMULATOR_GCC) -isysroot $(SIMULATOR_SDK) -arch i386  -c $(TEST_FILE) 

info:
    @echo "iphone gcc   : $(IPHONE_GCC_VER)"
    @echo "iphone sdk   : $(IPHONE_SDK_VER)"
    @echo "simulator gcc: $(SIMULATOR_GCC_VER)"
    @echo "simulator sdk: $(SIMULATOR_SDK_VER)"
    @echo ""

make-test-file:
    echo "#import <Foundation/Foundation.h>" > $(TEST_FILE)

Die Standardwerte sind diejenigen, die arbeiten, aber Sie können sie auf der Befehlszeile außer Kraft setzen. Zum Beispiel:

$ make -f Makefile.iphone-error-demo SIMULATOR_SDK_VER=3.0 SIMULATOR_GCC_VER=4.0
iphone gcc   : 4.0
iphone sdk   : 3.0
simulator gcc: 4.0
simulator sdk: 3.0

echo "#import <Foundation/Foundation.h>" > /tmp/test.m
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0    -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk     -arch armv6 -c /tmp/test.m 
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk -arch i386  -c /tmp/test.m 
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/Security.h:29,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSURLCredential.h:14,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:80,
                 from /tmp/test.m:1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:166: error: syntax error before ÔSecPaddingÕ
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:196: error: syntax error before ÔSecPaddingÕ
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:228: error: syntax error before ÔSecPaddingÕ
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/Security.framework/Headers/SecKey.h:257: error: syntax error before ÔSecPaddingÕ
make: *** [all] Error 1

oder

$ make -f Makefile.iphone-error-demo SIMULATOR_SDK_VER=2.0 SIMULATOR_GCC_VER=4.2
iphone gcc   : 4.0
iphone sdk   : 3.0
simulator gcc: 4.2
simulator sdk: 2.0

echo "#import <Foundation/Foundation.h>" > /tmp/test.m
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0    -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk     -arch armv6 -c /tmp/test.m 
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk -arch i386  -c /tmp/test.m 
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:12,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from /tmp/test.m:1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:16,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6,
                 from /tmp/test.m:1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/usr/include/float.h:8:24: error: float.h: No such file or directory
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:32,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:125,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:2,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:8,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:107,
                 from /tmp/test.m:1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:29:23: error: xmmintrin.h: No such file or directory
In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/DriverServices.h:32,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/CarbonCore.h:125,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Headers/CoreServices.h:21,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/ApplicationServices.framework/Headers/ApplicationServices.h:2,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSAppleEventDescriptor.h:8,
                 from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:107,
                 from /tmp/test.m:1:
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.0.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/MachineExceptions.h:216: error: expected specifier-qualifier-list before Ô__m128Õ
make: *** [all] Error 1

Sind Sie sicher, dass Ihre Einstellungen zwischen den beiden Projekten identisch sind? Ich wette, Sie versehentlich einige Simulator-Einstellungen geändert.

Rechts den Rahmen klicken und klicken Sie auf Get Info. Schauen Sie sich auf den Weg in den Info-Dialog. Es sollte kurz sein, wie "System / Library / Frameworks /"

Wenn dies nicht der Fall, verwenden Sie die Taste Wählen Sie den Rahmen unterhalb des aktuellen SDK-Ordner zu finden.

Also, stellen Sie sicher, dass gerade unter dem Pfad, den Sie sehen die Option "Relative to Current SDK" ausgewählt.

Wenn Sie den Rahmen zu einem Projekt hinzugefügt, hast Du die Checkbox auf JA, wenn Sie gefragt, ob Sie den Rahmen in die Projektordner kopieren wollen. Wenn ja, sollten Sie das Kontrollkästchen auf NO gesetzt werden.

Geschieht dies auch, wenn Sie ein neues Projekt erstellen und versuchen, ohne laufen etwas hinzuzufügen, weil es möglich ist, dass Sie versehentlich die Kompilierung Flags in diesem Projekt geändert haben

Dies sollte durch das Hinzufügen dieser zu den Compiler-Optionen festgelegt werden:

-D__IPHONE_OS_VERSION_MIN_REQUIRED=30000

Ich habe dieses Problem, wenn ein Projekt von sdk 3,2-4,1 ändern. Stellt sich die Lösung aus wurde die Änderung der iOS Deployment Ziel in den Buildeinstellungen meines Projekts von 2.0 3.0 .

Right Ihr Projekt in Xcode klicken (wenn Sie es verwenden), bauen Bereich iOS Deployment Target -.> 3.0

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top