0

本を読んでいますが、このコードでコンパイル中に 1 つのエラーが発生します。

$ rm -f injection.dylib
$ export PLATFORM=/Developer/Platforms/iPhoneOS.platform
$ $PLATFORM/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 \
-c -o injection.o injection.c \
-isysroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk \ -fPIC
$ $PLATFORM/Developer/usr/bin/ld \ -dylib -lsystem -lobjc \
-o injection.dylib injection.o \
-syslibroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk/

特にこの行で問題が発生しました:

$PLATFORM/Developer/usr/bin/arm-apple-darwin10-llvm-gcc-4.2 \
-c -o injection.o injection.c \
-isysroot $PLATFORM/Developer/SDKs/iPhoneOS5.0.sdk \ -fPIC

これがエラーです

 arm-apple-darwin10-llvm-gcc-4.2:  -fPIC: No such file or directory

どうすれば解決できますか... とはどういう意味ですか?

4

1 に答える 1

2

これは、コマンド ラインの入力ミスを意味します。

stieber@gatekeeper:~$ gcc \ -fPIC
gcc: error:  -fPIC: No such file or directory
gcc: fatal error: no input files
compilation terminated.

行の途中にある \ により、gcc (およびおそらく llvm-gcc も同様) が引数をオプションと見なすのをやめ、常にそれらをファイル名として扱うようになります。

stieber@gatekeeper:~$ gcc -fPIC
gcc: fatal error: no input files
compilation terminated.

期待される結果が得られます。

于 2012-07-21T18:09:31.377 に答える