From: ryot AT bigfoot DOT com (George Ryot) Newsgroups: comp.os.msdos.djgpp Subject: Re: make/linking trouble Message-ID: <382a4e50.5106703@news.clara.net> References: <80592o$mnp AT hermes DOT acs DOT unt DOT edu> X-Newsreader: Forte Agent 1.5/32.452 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 47 Date: Mon, 08 Nov 1999 23:08:51 GMT NNTP-Posting-Host: 195.8.92.159 X-Complaints-To: abuse AT clara DOT net X-Trace: nnrp3.clara.net 942102531 195.8.92.159 (Mon, 08 Nov 1999 23:08:51 GMT) NNTP-Posting-Date: Mon, 08 Nov 1999 23:08:51 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Morpheus" 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