Mail Archives: djgpp/1999/11/08/21:44:18
"Morpheus" <hall AT silo DOT cs DOT unt DOT edu> wrote:
> I am getting very frustrated, as I am out of practice with my C++. I'm
> having particular trouble with the make utility. I THINK I'm doing this
> right. I have four modules, one with a class (IniUtils.h & .cpp), two with
> functions (StringUtils.h & .cpp and FileUtils.h & .cpp), and one with a
> "main" function to test them (IniTest.cpp). I've included my Makefile. I
> won't include the other files (I will post them as replies). But I will say
> that IniUtils requires StringUtils and FileUtils, StringUtils requires
> FileUtils, FileUtils requires StringUtils, and IniTest is only testing
> IniUtils (its IniFile class), so it only includes IniUtils.h.
>
> *Makefile*
>
> OBJS = IniTest.o IniUtils.o StringUtils.o FileUtils.o
IniTest.o is the first file listed, so this line
> $(EXES): $(OBJS)
causes IniTest.cpp to be the first file compiled:
> IniTest.o: IniTest.cpp IniUtils.h StringUtils.h FileUtils.h
> $(CXX) $(CXXFLAGS) -c IniTest.cpp $(ERR)
I can see nothing obviously wrong with the makefile.
> Here's the error message from gcc.log:
>
> IniTest.o: In function `main':
> IniTest.cpp:1: undefined reference to `IniFile::IniFile(char *)'
> IniTest.cpp:2: undefined reference to `IniFile::setActiveSection(char *)'
> IniTest.cpp:3: undefined reference to `IniFile::getValue(char *)'
That suggests that for some reason the header IniUtils.h is not being
included in IniTest.cpp, but you do have that file #included. I would
forget the makefile for the time being and run gxx directly, or maybe
re-order OBJS to see if there are other similar problems.
Check that windows is not duping you into thinking that you are
including a file you are not. FWIW I find it easier using all lower
case for everything. Use dir to see the filename DOS is using.
You could try removing the header guards, and/or put a #error at the
top of IniUtils.h to prove that it is being read.
--
george
- Raw text -