Hello to all that read this…
I’m having some problems linking my files together. I have written a couple of classes and have written the following makefile for this set of files:
[b]CFILES = Timers.cc baseThread.cc controlThread.cc displayThread.cc ThreadProj.cc
OBJECTS = Timers.o baseThread.o controlThread.o displayThread.o ThreadProj.o
CFLAGS = -o proj
proj: $(OBJECTS)
QCC $(CFLAGS) $(OBJECTS)
Timers.o: Timers.cc Timers.h
QCC Timers.cc -o Timers.o
baseThread.o: baseThread.cc baseThread.h
QCC baseThread.cc -o baseThread.o
controlThread.o: controlThread.cc controlThread.h baseThread.h Timers.h
QCC controlThread.cc -o controlThread.o
displayThread.o: displayThread.cc displayThread.h baseThread.h Timers.h
QCC displayThread.cc -o displayThread.o
ThreadProj.o: ThreadProj.cc displayThread.h controlThread.h
QCC ThreadProj.cc -o ThreadProj.o
Timers.o baseThread.o controlThread.o displayThread.o: Timers.h
baseThread.o controlThread.o displayThread.o: baseThread.h
ThreadProj.o controlThread.o: controlThread.h
ThreadProj.o displayThread.o: displayThread.h
[/b]
When the makefile is launched the compilation terminates with the following errors:
make: Entering directory /home/COEN320/QNX_Project/Proj' QCC controlThread.cc -o controlThread.o /tmp/AAA149288_cc.o: In function
controlThread::controlThread(int)’:
/tmp/AAA149288_cc.o(.text+0xf): undefined reference to baseThread::baseThread(void)' /tmp/AAA149288_cc.o(.text+0x2b): undefined reference to
Timers::Timers(void)’
/tmp/AAA149288_cc.o(.text+0x6d): undefined reference to Timers::~Timers(void)' /tmp/AAA149288_cc.o(.text+0x7f): undefined reference to
baseThread::~baseThread(void)’
/tmp/AAA149288_cc.o: In function controlThread::~controlThread(void)': /tmp/AAA149288_cc.o(.text+0xd2): undefined reference to
Timers::~Timers(void)’
/tmp/AAA149288_cc.o(.text+0xe2): undefined reference to baseThread::~baseThread(void)' /tmp/AAA149288_cc.o: In function
controlThread::run1(void)’:
/tmp/AAA149288_cc.o(.text+0x31f): undefined reference to Timers::showTimeStats(void)' /tmp/AAA149288_cc.o(.text+0x331): undefined reference to
Timers::setStartCycle(void)’
/tmp/AAA149288_cc.o(.text+0x343): undefined reference to Timers::setStart(void)' /tmp/AAA149288_cc.o(.text+0x42b): undefined reference to
Timers::getStart(void)’
/tmp/AAA149288_cc.o(.text+0x445): undefined reference to Timers::showTimeSpan(timespec)' /tmp/AAA149288_cc.o(.text+0x45a): undefined reference to
Timers::getStartCycle(void)’
/tmp/AAA149288_cc.o(.text+0x46c): undefined reference to Timers::showElapsedCycles(int)' /tmp/AAA149288_cc.o: In function
controlThread type_info function’:
/tmp/AAA149288_cc.o(.gnu.linkonce.t.__tf13controlThread+0x10): undefined reference to baseThread type_info function' /tmp/AAA149288_cc.o(.gnu.linkonce.t.__tf13controlThread+0x1a): undefined reference to
baseThread type_info node’
cc: /usr/bin/ntox86-ld error 1
make: *** [controlThread.o] Error 1
make: Leaving directory `/home/COEN320/QNX_Project/Proj’
All the header files are properly referenced in their respective source files. I’ve tried many changes (g++ gives same results) but no luck. Although it doesn’t appear in the error dump the first two files (i.e. Timers.cc and baseThread.cc compile ok, and then all hell breaks loose. Anyone with any ideas of what’s wrong? Any feedback would be greatly appreciated.
PS