Linking in UNIX
Posted on 2004-08-23
I use g++ (most of the program is written in C, but a couple of files are written in C++). I usually use a makefile to build the project. Now I have a problem: all the .o are build ok, but the linkage fails. That's what I get:
g++ -Wall PerformDbTask.o Parse.o MyStr.o DateTime.o Main.o Ini.o LinkedList.o Memory.o DataManagement.o -o Main
PerformDbTask.o: In function `PerformDropTable(DB *, first_node *, string *)':
PerformDbTask.o(.text+0x111): undefined reference to `IniReadInt(first_node *, char *, char *, int)'
PerformDbTask.o(.text+0x17d): undefined reference to `IniReadStr(first_node *, char *, char *, char *)'
DataManagement.o: In function `FieldInit(Field **, first_node *, int)':
DataManagement.o(.text+0x301): undefined reference to `IniReadStr(first_node *, char *, char *, char *)'
IniReadInt, IniReadStr are all in Ini.c (& .h & .o), which was successfully built, and I compile with Ini.o. So I cannot see where the problem is (of course, I included Ini.h in PerformDbTask).