Hi,

try:

$(CC) server.cpp config.h $(CFLAGS) -c -o $@ $< -I./$(INCLUDE_PATH)


instead of:

 
$(CC) server.cpp config.h $(CFLAGS) -c $@ -I./$(INCLUDE_PATH)


Option -c tells the compiler that it shouldn't compile, but you have to use 
"-o" in order to specify the output. $@=server.o. Then use $< to enter the 
first dependency (server.cpp).

I hope this help.
BTW, is this related to OSSEC project?

Best regards.


On Friday, July 7, 2017 at 6:06:05 PM UTC+2, jackfruit1...@gmail.com wrote:
>
> I'am a rookie in makefile.this is the problem I have.It has been boring me 
> for a day.please give me some advice.
>
> this is my makefile
>
> CC = g++
> LINK = g++
> CFLAGS = -Wall
>
> INCLUDE_PATH = install/include
> LIB_PATH = install/lib
> LIBS = -lboost_thread -lboost_system -Llib #-ljsoncpp
>
> SRC_DIR = .
> VPATH = $(SRC_DIR)
> VPATH += $(SRC_DIR)/install/include
> VPATH += $(SRC_DIR)/install/include/libavcodec
> VPATH += $(SRC_DIR)/install/include/libavutil
> VPATH += $(SRC_DIR)/install/include/libavformat
> VPATH += $(SRC_DIR)/install/lib
>
> #object_server = server.o
>
> #server:$(object_server)
> # $(LINK) $(object_server) -o $@ -I./$(LIB_PATH)
>
> server.o:server.cpp config.h #$(INCLUDE_PATH)
> $(CC) server.cpp config.h $(CFLAGS) -c $@ -I./$(INCLUDE_PATH)
>
> clean:
> rm server.o server
>
>
> when I compile,this error occurs,"g++: error: server.o: No such file or 
> directory"
> I have got a halo.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"ossec-list" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ossec-list+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to