{Makefile Error} quot;commands commence before first target. Stop.quot;({Makefile 错误}“命令在第一个目标之前开始.停下.)
问题描述
我正在尝试制作一个与我的 Raspberry Pi 一起使用的 makefile,目的是使用 Pi 的相机板通过 opencv 检测人脸.但是我一直面临以下错误:
Makefile:12: *** 命令在第一个目标之前开始.停止.我使用以下生成文件:
FLAGS = 'pkg-config --cflags opencv --libs opencv'CC = g++家 =/家/piLDFLAGS_CAMCV = -L$(HOME)/git/robidouille/raspicam_cv -lraspicamcvLDFLAGS_USER =-L$(HOME)/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -$LDFLAGS_FACE = -l$(HOME)/git/emobot/libfacere0.04LDFLAGS = $(LDFLAGS_CAMCV) $(LDFLAGS_USER) $(LDFLAGS_FACE)包括 = -I$(HOME)/git/robidouille/raspicam_cv$(CC) -o emobot_test.exe: main.cpp $(INCLUDE) $(LDFLAGS)
LDFLAGS_CAMCV和LDFLAGS_USER是 raspicamcv 库所必需的,INCLUDE是相关的头文件.LDFLAGS_FACE需要在 opencv2.3 中检测人脸,因为 Pi 目前不支持 2.4.我确信这个错误非常微不足道,但是关于 makefile 的清晰文档很少,如果有人能提供解决方案,我将不胜感激.
解决方案喜欢:
<前>FLAGS = 'pkg-config --cflags opencv --libs opencv'CC = g++家 =/家/piLDFLAGS_CAMCV = -L$(HOME)/git/robidouille/raspicam_cv -lraspicamcvLDFLAGS_USER =-L$(HOME)/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -$LDFLAGS_FACE = -l$(HOME)/git/emobot/libfacere0.04LDFLAGS = $(LDFLAGS_CAMCV) $(LDFLAGS_USER) $(LDFLAGS_FACE)包括 = -I$(HOME)/git/robidouille/raspicam_cv全部:emobot_testemobot_test:tab$(CC) -o emobot_test.exe main.cpp $(INCLUDE) $(LDFLAGS)
说明:$(CC) -o emobot_test... 是应该在目标调用时执行的命令.
all 是默认目标,当您只运行不带参数的 make 时会执行该目标.
all 取决于 emobot_test 目标emobot_test 不依赖于任何目标,但总是运行 $(CC) -o emobot_test... 以完成
I'm trying to produce a makefile for use with my Raspberry Pi, the intention is to use the Pi's camera board to detect faces with opencv. However I keep facing myself with the following error:
Makefile:12: *** commands commence before first target. Stop.
I use the following makefile:
FLAGS = 'pkg-config --cflags opencv --libs opencv'
CC = g++
HOME = /home/pi
LDFLAGS_CAMCV = -L$(HOME)/git/robidouille/raspicam_cv -lraspicamcv
LDFLAGS_USER =-L$(HOME)/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -$
LDFLAGS_FACE = -l$(HOME)/git/emobot/libfacere0.04
LDFLAGS = $(LDFLAGS_CAMCV) $(LDFLAGS_USER) $(LDFLAGS_FACE)
INCLUDE = -I$(HOME)/git/robidouille/raspicam_cv
$(CC) -o emobot_test.exe: main.cpp $(INCLUDE) $(LDFLAGS)
LDFLAGS_CAMCV and LDFLAGS_USER are required for the raspicamcv library and INCLUDE is the associated header file. LDFLAGS_FACE is needed to detect faces in opencv2.3 as 2.4 is currently unsupported by the Pi.
I'm certain this error is incredibly trivial however clear documentation about makefiles is few and far between if anyone can provide a solution I would be grateful.
Smth like:
FLAGS = 'pkg-config --cflags opencv --libs opencv' CC = g++ HOME = /home/pi LDFLAGS_CAMCV = -L$(HOME)/git/robidouille/raspicam_cv -lraspicamcv LDFLAGS_USER =-L$(HOME)/git/raspberrypi/userland/build/lib -lmmal_core -lmmal -$ LDFLAGS_FACE = -l$(HOME)/git/emobot/libfacere0.04 LDFLAGS = $(LDFLAGS_CAMCV) $(LDFLAGS_USER) $(LDFLAGS_FACE) INCLUDE = -I$(HOME)/git/robidouille/raspicam_cv all: emobot_test emobot_test: tab$(CC) -o emobot_test.exe main.cpp $(INCLUDE) $(LDFLAGS)
<tab> is a literal keypress, donna how to insert it in the answer field.
Explanation:
$(CC) -o emobot_test... is a command which should be executed upon a target invocation.
all is the default target which is executed when you simply run make without parameters.
all depends on emobot_test target
emobot_test doesn't depend on any target but always runs $(CC) -o emobot_test... for completion
这篇关于{Makefile 错误}“命令在第一个目标之前开始.停下."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:{Makefile 错误}“命令在第一个目标之前开始.停下."
基础教程推荐
- 初始化列表*参数*评估顺序 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- CString 到 char* 2021-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
