X
xuatla
Is it off-topic here or not? If not, please help me. Thanks in advance.
X
--------------------
I have main.cpp, tfunclib.cpp in the current folder (same as makefile),
and "library files" vmclass.cpp, tclass.cpp, newtonsolver.cpp in another
folder (mentioned below as OBJDIR). i compile those "library files" and
it's ok.
now i want to make main.cpp in the current folder. how can i specify the
director to the makefile so that it knows where i put the library files?
I got the following msg for output:
--------------------
make: *** No rule to make target `tclass.cpp', needed by `tclass.o'. Stop.
--------------------
and my source code of makefile below:
--------------------
TARGET = main
OBJDIR = /home1/user/personal/program/cpplibrary/standard
OBJ = main.o tfunclib.o tclass.o vmclass.o newtonsolver.o
CL = g++
INCLUDEDIR = -I/home1/user/personal/program/cpplibrary/standard
$(TARGET) : $(OBJ)
$(CL) -o $(TARGET) $(OBJ)
main.o : main.cpp
$(CL) -c $(INCLUDEDIR) main.cpp
tfunclib.o : tfunclib.cpp
$(CL) -c $(INCLUDEDIR) tfunclib.cpp
$(OBJDIR)/vmclass.o: $(OBJDIR)/vmclass.cpp $(OBJDIR)/vmclass.h
$(CL) -c $(INCLUDEDIR) $(OBJDIR)/vmclass.cpp \
-o $(OBJDIR)/vmclass.o
$(OBJDIR)/tclass.o : tclass.cpp tclass.h
$(CL) -c $(INCLUDEDIR) $(OBJDIR)/tclass.cpp \
-o $(OBJDIR)/tclass.o
$(OBJDIR)/newtonsolver.o : newtonsolver.cpp newtonsolver.h
$(CL) -c $(INCLUDEDIR) $(OBJDIR)/newtonsolver.cpp \
-o $(OBJDIR)/newtonsolver.o
..PHONY : clean
clean:
rm $(TARGET) $(OBJ)
# END OF MAKEFILE
X
--------------------
I have main.cpp, tfunclib.cpp in the current folder (same as makefile),
and "library files" vmclass.cpp, tclass.cpp, newtonsolver.cpp in another
folder (mentioned below as OBJDIR). i compile those "library files" and
it's ok.
now i want to make main.cpp in the current folder. how can i specify the
director to the makefile so that it knows where i put the library files?
I got the following msg for output:
--------------------
make: *** No rule to make target `tclass.cpp', needed by `tclass.o'. Stop.
--------------------
and my source code of makefile below:
--------------------
TARGET = main
OBJDIR = /home1/user/personal/program/cpplibrary/standard
OBJ = main.o tfunclib.o tclass.o vmclass.o newtonsolver.o
CL = g++
INCLUDEDIR = -I/home1/user/personal/program/cpplibrary/standard
$(TARGET) : $(OBJ)
$(CL) -o $(TARGET) $(OBJ)
main.o : main.cpp
$(CL) -c $(INCLUDEDIR) main.cpp
tfunclib.o : tfunclib.cpp
$(CL) -c $(INCLUDEDIR) tfunclib.cpp
$(OBJDIR)/vmclass.o: $(OBJDIR)/vmclass.cpp $(OBJDIR)/vmclass.h
$(CL) -c $(INCLUDEDIR) $(OBJDIR)/vmclass.cpp \
-o $(OBJDIR)/vmclass.o
$(OBJDIR)/tclass.o : tclass.cpp tclass.h
$(CL) -c $(INCLUDEDIR) $(OBJDIR)/tclass.cpp \
-o $(OBJDIR)/tclass.o
$(OBJDIR)/newtonsolver.o : newtonsolver.cpp newtonsolver.h
$(CL) -c $(INCLUDEDIR) $(OBJDIR)/newtonsolver.cpp \
-o $(OBJDIR)/newtonsolver.o
..PHONY : clean
clean:
rm $(TARGET) $(OBJ)
# END OF MAKEFILE