C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 3rd, 2002, 01:22 PM
lux lux is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 42 lux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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!!

Reply With Quote
  #2  
Old July 3rd, 2002, 01:51 PM
Lord MJ Lord MJ is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2001
Posts: 34 Lord MJ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 57 m 2 sec
Reputation Power: 7
Send a message via AIM to Lord MJ Send a message via Yahoo to Lord MJ
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.

Reply With Quote
  #3  
Old July 3rd, 2002, 01:54 PM
lux lux is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 42 lux User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I did that

all: $(EXEC1) $(EXEC2)


all calls the two targets, but I'm still getting errors

Reply With Quote
  #4  
Old July 16th, 2002, 03:01 PM
chance chance is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 4 chance User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > makefile - two executables


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway