which group can i ask for makefile?

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
 
J

John Harrison

Is it off-topic here or not? If not, please help me. Thanks in advance.

It's off topic, but see below.

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

I could easily be wrong but the obvious thing to me would be to replace

OBJ = main.o tfunclib.o tclass.o vmclass.o newtonsolver.o

with

OBJ = main.o tfunclib.o $(OBJDIR)/tclass.o $(OBJDIR)/vmclass.o
$(OBJDIR)/newtonsolver.o

but that's just a guess.

If that doesn't help try a group with linux and development in its name,
e.g. They should know about gnu make.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top