
July 3rd, 2002, 01:22 PM
|
|
Senior Member
|
|
Join Date: Jul 2001
Posts: 42
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
makefile - two executables
i'm trying to create a makefile which will give two executables, but i'm having some problems. this is my makefile
Code:
CCC = g++
EXEC1 = HEncode
EXEC2 = HDecode
OBJ1 = main.o HEncode.o Tree.o Node.o
OBJ2 = main.o HDecode.o Tree.o Node.o
all: $(EXEC1) $(EXEC2)
$(EXEC1): $(OBJ1)
$(CCC) $(OBJ1) -o $(EXEC1)
$(EXEC2): $(OBJ2)
$(CCC) $(OBJ2) -o $(EXEC2)
main.o: main.cc
HEncode.o: HEncode.cc HEncode.h
HDecode.o: HDecode.cc HDecode.h
Tree.o: Tree.cc Tree.h
Node.o: Node.cc Node.h
which gives me the following error:
Code:
g++ main.o HEncode.o Tree.o Node.o -o HEncode
Undefined first referenced
symbol in file
HDecode::decode(void) main.o
HDecode::~HDecode(void) main.o
HDecode::HDecode(basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> >)main.o
ld: fatal: Symbol referencing errors. No output written to HEncode
collect2: ld returned 1 exit status
make: *** [HEncode] Error 1
but if I change the all target line to:
all: $(EXEC2) $(EXEC1)
I get
Code:
g++ -c -o HDecode.o HDecode.cc
g++ main.o HDecode.o Tree.o Node.o -o HDecode
Undefined first referenced
symbol in file
HEncode::encode(void) main.o
HEncode::~HEncode(void) main.o
HEncode::HEncode(basic_string<char, string_char_traits<char>, __default_alloc_template<false, 0> >)main.o
ld: fatal: Symbol referencing errors. No output written to HDecode
collect2: ld returned 1 exit status
make: *** [HDecode] Error 1
So I know it's a problem with my makefile.. besides, all the classes are pretty much empty..
so how do I create a makefile which will give two executables?
thanks for any help!! 
|