0

私のiPhoneプロジェクトでは、インラインasmを使用していますが、ターゲットアーキテクチャがシミュレータではなくデバイスである場合は除外されます。

インライン asm コードの一部はアームのみで、thumb ではないため、iPhone 用にコンパイルするときに c フラグ -marm を指定する必要があります。

ファイル固有のビルド設定で -marm フラグを入力すると問題が発生し、シミュレーター用にコンパイルすると gcc がエラーを出力します。

cc1obj: エラー: コマンド ライン オプション "-marm" を認識できません

ターゲット アーキテクチャがアームの場合にのみ、このオプションを渡す方法はありますか? グローバルな c フラグを使用して実行できることはわかっていますが、プロジェクト全体を -marm フラグでコンパイルしたくありません。少数の .m ファイルだけを -marm にしたい。

ありがとう、キム

4

1 に答える 1

0

OK、問題の解決策を見つけました。

コードに追加したコメントは次のとおりです。

// the asm code only works with arm not with thumb,
// so if you compile it and gcc trys to compile it as thumb
// you will get an error.
// to make gcc compile the file as arm and not thumb you need
// to add -marm to the files compiler config (select the file
// and press cmd + i and select the build tab and enter there
// the problem is that if you try to compile for the simulator
// it will fail, because intel gcc doesnt know the flat -marm.
// To solve this add a new "User defined setting" in your targets 
// build settings with the name use_marm and give it the value ""
// then add a build setting condition and select Any iPhone OS
// Device and give it the value "-marm"
// In your file's compiler flags add $use_marm
// If you build for the device it will add -marm and if you
// build for the simulator it wont.
于 2009-10-26T23:38:05.133 に答える