23

CoreAudioでの作業をカプセル化するラッパー関数をいくつか作成しました。目標は、いくつかのコマンドラインC++ツールで使用できるCライブラリを作成することです。これまでのところ、物事はうまく機能しています。サンプルプロジェクトを取得して変更すると、XCodeでビルドおよび実行されます。XCodeを完全にスキップして、gccとMakefileを使用してライブラリをビルドしたいと思います。

Apple Frameworkに対してリンクするにはどうすればよいですか?フレームワークは、gccの-lおよび-Lオプションに含めることができる共有ライブラリですか?

4

1 に答える 1

29

次に例を示します。

gcc -framework CoreServices -o test test.c

Appleのgcc(i686-apple-darwin10-gcc-4.2.1)のマニュアルページから:

   In addition to the options listed below, Apple's GCC also accepts and
   passes nearly all of the options defined by the linker ld and by the
   library tool libtool.  Common options include -framework, -dynamic,
   -bundle, -flat_namespace, and so forth.  See the ld and libtool man
   pages for further details.

そして、ldのmanページから:

 -framework name[,suffix]
             This option tells the linker to search for `name.frame-
             work/name' the framework search path.  If the optional suffix
             is specified the framework is first searched for the name
             with the suffix and then without (e.g. look for `name.frame-
             work/name_suffix' first, if not there try `name.frame-
             work/name').
于 2009-11-22T22:30:24.240 に答える