2012-01-05 9 views
0

質問:/asm-generic/cmpxchg-local.hにアクセスするためには、何をリンクする必要がありますか?asm-generic/cmpxchg-local.hに対してコンパイルできません。


情報:

は、私はいくつかの場所のリンクを欠けている知っているが、私は右のコマンドを把握することはできません。コンパイラをリンクするときはあまり良くありません。私はcmpxchg-local.hへのアクセスをテストする簡単なプログラムをコンパイルしようとしました。私はそれを "asm-generic/cmpxchg-local.h"としてやっているのを見ましたが、それもうまくいきませんでした。私が見つけ走った、それはここにファイルが見つかりました:それは見つけることができなかったことを私に教えて進め

#include </usr/src/linux-headers-3.0.0-14/include/asm-generic/cmpxchg-local.h> 
#include <stdio> 

int main() 
{ 
    printf("Hello world!\n"); 
} 

:私はそうのように含めるにだから私は、全体のファイルパスを入れてみました

/usr/src/linux-headers-3.0.0-14/include/asm-generic/cmpxchg-local.h 

をlinux/irqflags.h。明らかにいくつかのリンクはいくつかの行方不明、任意の助言?でコンパイル

gcc cmpandswp.c -o test -lm 

答えて

0

おそらく、ユーザープログラムでカーネルヘッダを含めたい...しかし、あなたが探しているのは(manページから)以下のGCCフラグですません。

-I dir 
     Add the directory dir to the list of directories to be searched for header files. Directories named by -I are searched before the standard system include directories. If the 
     directory dir is a standard system include directory, the option is ignored to ensure that the default search order for system directories and the special treatment of system 
     headers are not defeated . If dir begins with "=", then the "=" will be replaced by the sysroot prefix; see --sysroot and -isysroot. 

この方法で、あなたはgcc -I/usr/src/linux-headers-3.0.0-14/include <objects>ような何かをし、あなたの#include <asm-generic/cmpxchg-local.h>に含める変更することができます。そのヘッダファイルをコンパイルするには、おそらくは-I個のパスを追加する必要があります(ただし、やはりこれはおそらくあなたがやりたいことではありません)。

関連する問題