|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
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!! ![]() |
|
#2
|
|||
|
|||
|
You'll want to create a Make target that calls two other targets.
The 2 targets will be the ones that create your two executables. |
|
#3
|
|||
|
|||
|
I did that
all: $(EXEC1) $(EXEC2) all calls the two targets, but I'm still getting errors |
|
#4
|
|||
|
|||
|
Are you sure the make file is the problem?
I think you may be telling the Makefile to do the wrong thing. if you type "g++ main.o HEncode.o Tree.o Node.o -o HEncode" on command line do you get same error as if Makefile were used to issue this command? I'd guess you either don't have these functions defined that g++ is griping about, or you need to pass some other option to g++ to let it know where to find some kind of template. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > makefile - two executables |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|