Reputation: 2777
I have modified a makefile and trying to compile a project. But it is failing in fist step only.
Even i have specified pattern rule for compiling, w.r.t :--
http://www.gnu.org/software/make/manual/make.html#Static-Usage
Makefile is :--
# topdir for wxWidgets base
top_builddir = /opt/wxgtk
EXTRALIBS = -pthread -lz -ldl -lm
LDLIBS = ${APPEXTRALIBS} ${top_builddir}/lib/libwx_baseu-2.8.a ${EXTRALIBS}
CXX = c++
CXXFLAGS = -g -O0 -pthread -I/usr/include/SDL -D_REENTRANT -Wall -Wno-ctor-dtor-privacy
CPPFLAGS = -D__WXDEBUG__ -I${top_builddir}/wx/include/base-unicode-release-static-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D_LARGEFILE_SOURCE=1
CFLAGS = ${APPEXTRACFLAGS} ${CPPFLAGS} -O2 -MMD -pthread -Wall
CFLAGS += -DLINUX
CANALOBJS = ../../common/listenthread_unix.o ../../common/clientthread_level1_unix.o ../../common/devicethread_unix.o \
../../common/canalshmem_level1_unix.o ../../common/clientlist.o ../../common/controlobject.o \
../../common/devicelist.o ../../common/udpreceivethread_unix.o ../../../vscp/common/vscp.o \
../../common/clientthread_level2_unix.o ../../common/canalshmem_level2_unix.o \
../../common/tcplistenthread.o
CANALHDRS = ../../common/clientlist.h ../../common/controlobject.h ../../common/devicelist.h \
../../common/canal.h ../../common/canaldlldef.h \
../../common/version.h ../../common/canal_unix_ipc.h ../../common/CanalShMem_level1_unix.h \
../../common/CanalShMem_level2_unix.h ../../common/clientthread_level1_unix.h ../../common/clientthread_level2_unix.h
PROJOBJS = ../../../common/dllist.o ../../../common/configfile.o ../../../common/crc.o
PROJHDRS = ../../../common/dllist.h ../../../common/configfile.h
OBJS = canald.o
HDRS = canald.h
all: canald
# Build the Linux executable
canald: $(OBJS) $(HDRS) $(CANALOBJS) $(CANALHDR) $(PROJOBJS) $(PROJHDRS)
$(CXX) -o canald $(OBJS) $(CANALOBJS) $(PROJOBJS) -L$(LIBS) $(LDLIBS)
$(OBJS) $(CANALOBJS) $(PROJOBJS):%.o: %.cpp
$(CXX) -c $(CFLAGS) $< -o $@
error i am getting :--
make
make: *** No rule to make target `canald.cpp', needed by `canald.o'. Stop.
Please suggest how to resolve this error ?
EDITED :-------
file was missing... its compiling ... but getting following error
vscpd.cpp:47:19: fatal error: wx/wx.h: No such file or directory
compilation terminated.
make: *** [vscpd.o] Error 1
I have installed wxgtk at following location :---
/opt/wxgtk
.profile is modified :--
PATH = $PATH:/opt/wxgtk
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/opt/wxgtk/lib:$LD_LIBRARY_PATH
Make is not able to find
#include<wx/wx.h>
How to resolve it ?
Upvotes: 0
Views: 727
Reputation: 22688
You must use wx-config
instead of specifying the include paths directly, see e.g. this answer.
Your makefile is pretty strange as you define CXXFLAGS
only to never use it and instead use CPPFLAGS
as part of CFLAGS
. So in your case you need to replace CPPFLAGS
definition with a wx-config
invocation, e.g.
WX_CONFIG := /opt/wxgtk/bin/wx-config
CPPFLAGS := $(shell $(WX_CONFIG) --cxxflags)
Better, get rid of CPPFLAGS
and define CXXFLAGS
like this and use it.
Also update your LDLIBS
to use wx-config
too:
LDLIBS := ${APPEXTRALIBS} $(shell $(WX_CONFIG) --libs)
(EXTRALIBS
shouldn't be normally needed at all any more).
Upvotes: 1