我尝试编译一个程序。但我认为它不起作用,因为包含路径不正确。
我使用 ELDK 中的 power-linux-gcc。
文件结构是这样的
linux-kernel ----- driver----graphic_test----- Makefile
| |
| | -- main.c
|
-- include--linux --- jiffies.h
|
-- semaphore.h
这是我将它们包含在 semLib.c 文件中的方式
#include <jiffies.h>
#include <semaphore.h>
我也试过
#include <linux/jiffies.h>
#include <linux/semaphore.h>
我不太确定问题是否在于包含,但我认为。
那是我的Makefile:
CC=powerpc-linux-gcc
LIBS = ../../kernel/time/jiffies.o ../../kernel/semaphore.o #libdrmko.o libdrm.o libs3gko.o
INC = -I../../include
C_SRC = main.c lstLib.c systLib.c semLib.c #taskLib.c
C_OBJ = main.o lstLib.o systLib.o semLib.o # taskLib.o
graphics_test: $(LIBS) $(C_OBJ)
$(CC) -o graphics_test $(LIBS) $(C_OBJ) $(INC)
那是来自make
:~/Linux_Development_Workspace/linux-kernel/drivers/graphic_test$ make
powerpc-linux-gcc -c -o ../../kernel/semaphore.o ../../kernel/semaphore.c
../../kernel/semaphore.c:28:28: error: linux/compiler.h: No such file or directory
../../kernel/semaphore.c:30:26: error: linux/module.h: No such file or directory
../../kernel/semaphore.c:32:29: error: linux/semaphore.h: No such file or directory
../../kernel/semaphore.c:33:28: error: linux/spinlock.h: No such file or directory
../../kernel/semaphore.c:34:26: error: linux/ftrace.h: No such file or directory
../../kernel/semaphore.c:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
../../kernel/semaphore.c:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
../../kernel/semaphore.c:38: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
../../kernel/semaphore.c:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
../../kernel/semaphore.c:40: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
../../kernel/semaphore.c:53: warning: 'struct semaphore' declared inside parameter list
../../kernel/semaphore.c:53: warning: its scope is only this definition or declaration, which is probably not what you want
../../kernel/semaphore.c: In function 'down':
../../kernel/semaphore.c:57: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:58: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:59: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:62: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c: At top level:
../../kernel/semaphore.c:64: warning: data definition has no type or storage class
../../kernel/semaphore.c:64: warning: parameter names (without types) in function declaration
../../kernel/semaphore.c:75: warning: 'struct semaphore' declared inside parameter list
../../kernel/semaphore.c: In function 'down_interruptible':
../../kernel/semaphore.c:80: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:81: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:82: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:85: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c: At top level:
../../kernel/semaphore.c:89: warning: data definition has no type or storage class
../../kernel/semaphore.c:89: warning: parameter names (without types) in function declaration
../../kernel/semaphore.c:101: warning: 'struct semaphore' declared inside parameter list
../../kernel/semaphore.c: In function 'down_killable':
../../kernel/semaphore.c:106: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:107: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:108: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:111: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c: At top level:
../../kernel/semaphore.c:115: warning: data definition has no type or storage class
../../kernel/semaphore.c:115: warning: parameter names (without types) in function declaration
../../kernel/semaphore.c:130: warning: 'struct semaphore' declared inside parameter list
../../kernel/semaphore.c: In function 'down_trylock':
../../kernel/semaphore.c:135: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:136: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:138: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:139: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c: At top level:
../../kernel/semaphore.c:143: warning: data definition has no type or storage class
../../kernel/semaphore.c:143: warning: parameter names (without types) in function declaration
../../kernel/semaphore.c:155: warning: 'struct semaphore' declared inside parameter list
../../kernel/semaphore.c: In function 'down_timeout':
../../kernel/semaphore.c:160: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:161: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:162: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:165: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c: At top level:
../../kernel/semaphore.c:169: warning: data definition has no type or storage class
../../kernel/semaphore.c:169: warning: parameter names (without types) in function declaration
../../kernel/semaphore.c:178: warning: 'struct semaphore' declared inside parameter list
../../kernel/semaphore.c: In function 'up':
../../kernel/semaphore.c:182: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:183: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:184: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c:187: error: dereferencing pointer to incomplete type
../../kernel/semaphore.c: At top level:
../../kernel/semaphore.c:189: warning: data definition has no type or storage class
../../kernel/semaphore.c:189: warning: parameter names (without types) in function declaration
../../kernel/semaphore.c:194: error: field 'list' has incomplete type
../../kernel/semaphore.c:204: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__down_common'
../../kernel/semaphore.c:236: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
../../kernel/semaphore.c:241: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
../../kernel/semaphore.c:246: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
../../kernel/semaphore.c:251: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'
../../kernel/semaphore.c:256: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'void'
make: *** [../../kernel/semaphore.o] Fehler 1