Issue
So I am attempting to compile a C program on my Raspberry Pi, and the instructions tell me to "addinclude uninstd" followed by the exact code:
sed -i 's | #include <arpa / inet.h> | #include <arpa / inet.h> n #include <unistd.h> | g 'openmilight.cpp
So, I believe the instructions are saying to modify the makefile, but what exactly do I put in the Makefile to include these libraries?
Here is the entire Makefile currently:
CC = g++
CFLAGS = -c -Wall
LIBS = -lrf24-bcm
SOURCES = PL1167_nRF24.cpp MiLightRadio.cpp openmilight.cpp
BIN = openmilight
all: $(SOURCES) $(BIN)
$(BIN): $(SOURCES:.cpp=.o)
$(CC) $^ -o $@ $(LIBS)
%.o: %.cpp
$(CC) $(CFLAGS) -o $@ $<
clean:
rm -f *.o $(BIN)
Thank you, I am only vaguely familiar with working with Makefiles and this is confusing me like none other.
If it helps, here is the exact code I am attempting to run: http://torsten-traenkner.de/wissen/smarthome/openmilight.php It is in german, which may be why it is being lost in translation.
Solution
The instruction is a sed command to modify the file openmilight.cpp
. Nothing to do with makefiles.
Just execute the bash command in the directory of openmilight.cpp
or add the inclusion by hand: open openmilight.cpp
in your preferred editor and add the line
#include <unistd.h>
just after
#include <arpa/inet.h>
Answered By - YSC