Re: Compiling C Program by Linking Object File generated from ".ec file."
Posted in 1999
Vikraman N wrote: > Hi All, > > I have to compile a program "smain.c" , which calls a function > "sfunc",which is basically an "embbeded c file" with .ec extension > (i.e sfunc.ec.) > > I have got the object file of the function sfunc.ec named "sfunc.o" > archieved in the library called "libfunc.a." > > Now When I am trying to create a final executable for my main program > using "cc -o prog -dn -L./ smain.c -lfunc ",by linking the library > containing the object file for that function I am getting the > following error: > > Error: > > Undefined first referenced > symbol in file > .................................................. > .................................................. > .................................................. > ld: prog: fatal error: Symbol referencing errors. No output written to > prog . > > (prog is the final executable.) > > Can anyone tell me why I am getting this error? > > Thanks in advance.(I am working DYNIX/ptx 4.0 V4.4.2 i386 version of > unix) > > Viky > > 1. You should add Informix libraries - at least -L$INFORMIXDIR/lib -L$INFORMIXDIR/lib/esql \\ -lixsql -lixasf -lixgen -lixos -lixgls -lnsl -lsocket -laio -lm 2. Another way is to run esql -v somefile.ec and look into "ld" command line parameters 3. Simplest method: esql -o prog smain.c -L./ -lfunc Hope this helps Leonid