相关疑难解决方法(0)

makefile:4:***缺少分隔符.停止

这是我的makefile:

all:ll

ll:ll.c   
  gcc  -c  -Wall -Werror -02 c.c ll.c  -o  ll  $@  $<

clean :
  \rm -fr ll
Run Code Online (Sandbox Code Playgroud)

当我尝试make cleanmake make,我得到这个错误:

:makefile:4: *** missing separator.  Stop.
Run Code Online (Sandbox Code Playgroud)

我该如何解决?

c makefile

397
推荐指数
10
解决办法
41万
查看次数

出错:缺少分隔符

运行时出现以下错误make:

Makefile:168: *** missing separator.  Stop.
Run Code Online (Sandbox Code Playgroud)

是什么造成的?

makefile

208
推荐指数
7
解决办法
15万
查看次数

insmod错误:插入'./hello.ko': - 无效的模块格式"

我刚刚制作了我的第一个驱动模块,跟随LDD3的hello world模块.但遗憾的是遇到了这个错误:

insmod: error inserting './hello.ko': -1 Invalid module format.
Run Code Online (Sandbox Code Playgroud)

我在Ubuntu 11.04和我的环境中这样做:

$ uname -r
2.6.38-8-generic
Run Code Online (Sandbox Code Playgroud)

我得到这样的内核源代码:

sudo apt-cache search linux-source
linux-source - Linux kernel source with Ubuntu patches
linux-source-2.6.38 - Linux kernel source for version 2.6.38 with Ubuntu patches
$sudo apt-get install linux-source-2.6.38
Run Code Online (Sandbox Code Playgroud)

我的/ usr/src:

$ls /usr/src/
linux-headers-2.6.38-8          linux-source-2.6.38          vboxguest-5.0.10
linux-headers-2.6.38-8-generic  linux-source-2.6.38.tar.bz2
Run Code Online (Sandbox Code Playgroud)

然后我编译内核

$sudo cp /boot/config-2.6.38-8-generic ./.config
$sudo make menuconfig -- load the .config file
$make
$make modules
Run Code Online (Sandbox Code Playgroud)

然后我编译我的内核模块

$make -C /usr/src/linux-source-2.6.38/linux-source-2.6.38 M=`pwd` modules
Run Code Online (Sandbox Code Playgroud)

使用Makefile:

obj-m := hello.o
Run Code Online (Sandbox Code Playgroud)

然后最后当我插入模块时: …

linux kernel-module linux-device-driver linux-kernel embedded-linux

10
推荐指数
1
解决办法
4万
查看次数

使用g ++编译Makefile时遇到问题

我有一个Makefile的文本,我正在尝试编译它并生成一个.e可执行文件.我试图用g ++编译它,但我遇到了一些困难.请注意我有一台运行Mavericks的MacBook Pro.

我尝试过两种方法 - 第一种方法是打开Xcode并创建一个新的.cpp文件.然后我将Makefile文本复制到空的.cpp文件中并将其保存为Makefile.g ++.在Mac终端,我然后执行

g++ Makefile.g++
Run Code Online (Sandbox Code Playgroud)

它返回错误

d: warning: ignoring file Makefile.g++, file was built for unsupported file format (      
0x23 0x20 0x47 0x65 0x6E 0x65 0x72 0x69 0x63 0x20 0x70 0x69 0x6D 0x63 0x20 0x67 ) which  
is not the architecture being linked (x86_64): Makefile.g++

Undefined symbols for architecture x86_64:
"_main", referenced from:
 implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v …
Run Code Online (Sandbox Code Playgroud)

c++ macos makefile g++ clang

1
推荐指数
1
解决办法
682
查看次数