undefined reference continues

Alfred Lam alfredlam@nowmediatech.com
Thu Oct 31 01:16:00 GMT 2002


This is a shapshot from my working folder as I get undefined references
to...xxx

gcc -c main.c to get  main.o
gcc main.o -L. -lctapi -o main.so to get main.so and where ctapi is the
library ctapi.lib or libctapi.a. I have both.

My .lib library is ctapi.lib

This is my working folder.
a@ALFRED ~/scm
$ ls
Ct_api.o   SerialIFx.o  T0Handlr.o  ct_api.h   libctapi.a  main.h   main.o
MagCard.o  Stc.o        T1Handlr.o  ctapi.lib  main.c      main.lo

All the .os are from libctapi.a. My aim is to use the ctapi.lib, but it's
not working, so I tried with .a, still cannot. main.lo was created from
libtool

a@ALFRED ~/scm
$ gcc -c main.c

a@ALFRED ~/scm
$ gcc main.o ctapi.o -o main.so
gcc: ctapi.o: No such file or directory

a@ALFRED ~/scm
$ gcc *.o ctapi.lib ctapi.o -o main.so
gcc: ctapi.o: No such file or directory

a@ALFRED ~/scm
$ gcc main.o -L. -lctapi -o main.so
main.o(.text+0x64):main.c: undefined reference to `_CT_init'
main.o(.text+0xa1):main.c: undefined reference to `_CT_close'
main.o(.text+0x14b):main.c: undefined reference to `_CT_data'
main.o(.text+0x213):main.c: undefined reference to `_CT_data'
main.o(.text+0x36b):main.c: undefined reference to `_CT_data'
collect2: ld returned 1 exit status

a@ALFRED ~/scm
$ gcc main.o ctapi.lib -o main.so
main.o(.text+0x64):main.c: undefined reference to `_CT_init'
main.o(.text+0xa1):main.c: undefined reference to `_CT_close'
main.o(.text+0x14b):main.c: undefined reference to `_CT_data'
main.o(.text+0x213):main.c: undefined reference to `_CT_data'
main.o(.text+0x36b):main.c: undefined reference to `_CT_data'
collect2: ld returned 1 exit status

a@ALFRED ~/scm
$ gcc main.c ctapi.lib -o main.so
/cygdrive/c/WINDOWS/TEMP/ccqw6CWr.o(.text+0x64):main.c: undefined reference
to `
_CT_init'
/cygdrive/c/WINDOWS/TEMP/ccqw6CWr.o(.text+0xa1):main.c: undefined reference
to `
_CT_close'
/cygdrive/c/WINDOWS/TEMP/ccqw6CWr.o(.text+0x14b):main.c: undefined reference
to
`_CT_data'
/cygdrive/c/WINDOWS/TEMP/ccqw6CWr.o(.text+0x213):main.c: undefined reference
to
`_CT_data'
/cygdrive/c/WINDOWS/TEMP/ccqw6CWr.o(.text+0x36b):main.c: undefined reference
to
`_CT_data'
collect2: ld returned 1 exit status

a@ALFRED ~/scm
$ gcc  main.c -L. -lctapi -shared -o main.so
/cygdrive/c/WINDOWS/TEMP/ccVxXET3.o(.text+0x64):main.c: undefined reference
to `
_CT_init'
/cygdrive/c/WINDOWS/TEMP/ccVxXET3.o(.text+0xa1):main.c: undefined reference
to `
_CT_close'
/cygdrive/c/WINDOWS/TEMP/ccVxXET3.o(.text+0x14b):main.c: undefined reference
to
`_CT_data'
/cygdrive/c/WINDOWS/TEMP/ccVxXET3.o(.text+0x213):main.c: undefined reference
to
`_CT_data'
/cygdrive/c/WINDOWS/TEMP/ccVxXET3.o(.text+0x36b):main.c: undefined reference
to
`_CT_data'
collect2: ld returned 1 exit status



This is a more detailed info from cygwin.
$ cygcheck -s -v -r |more

Cygwin Win95/NT Configuration Diagnostics
Current System Time: Thu Oct 31 10:23:52 2002

Windows 98 SE Ver 4.10 Build 2222

Path:   D:\cygwin\usr\local\bin
        D:\cygwin\bin
        D:\cygwin\bin
        c:\WINDOWS
        c:\WINDOWS\COMMAND
        c:\J2SDK1.4.1\BIN
        c:\PROGRA~1\MICROS~4\80\TOOLS\BINN
        c:\PROGRA~1\ULTRAE~1

SysDir: C:\WINDOWS\SYSTEM
WinDir: C:\WINDOWS

HOME = `D:\cygwin\home\a'
MAKE_MODE = `unix'
PWD = `/home/a'
USER = `a'
BLASTER = `A220 I5 D1 T4 P330'
CLASSPATH =
`.;C:\;C:\PROGRA~1\JMF21~1.1\LIB\SOUND.JAR;D:\card_code2\API.JAR;C:\
PROGRA~1\JMF21~1.1\LIB\JMF.JAR;c:\jlirc\jlirc;c:\j2sdk1.4.1\lib\comm.jar;D:\
work
\jni2ctapi-1.0.0\jni2ctapi.jar; '
CMDLINE = `bash --login -i'
COMSPEC = `C:\WINDOWS\COMMAND.COM'
HOMEDRIVE = `D:'
HOMEPATH = `\cygwin\home\a'
JAVA_HOME = `C:\j2sdk1.4.1'
OLDPWD = `/usr/bin'
PROMPT = `$p$g'
PS1 = `\[\033]0;\w\007
\033[32m\]\u@\h \[\033[33m\w\033[0m\]
$ '
SHLVL = `1'
TEMP = `c:\WINDOWS\TEMP'
TERM = `cygwin'
TMP = `c:\WINDOWS\TEMP'
WINBOOTDIR = `C:\WINDOWS'
WINDIR = `C:\WINDOWS'
_ = `/usr/bin/cygcheck'

HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\mounts v2
HKEY_CURRENT_USER\Software\Cygnus Solutions\Cygwin\Program Options
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2
  (default) = `/cygdrive'
  cygdrive flags = 0x00000022
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/
  (default) = `D:\cygwin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/bin
  (default) = `D:\cygwin/bin'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\mounts v2\/usr/lib
  (default) = `D:\cygwin/lib'
  flags = 0x0000000a
HKEY_LOCAL_MACHINE\Software\Cygnus Solutions\Cygwin\Program Options

a:  fd           N/A    N/A
c:  hd  FAT32   1800Mb  97% CP    UN
d:  hd  FAT32   1996Mb  68% CP    UN
e:  cd           N/A    N/A
D:\cygwin      /          system  binmode
D:\cygwin/bin  /usr/bin   system  binmode
D:\cygwin/lib  /usr/lib   system  binmode
.              /cygdrive  user    binmode,cygdrive

Found: D:\cygwin\bin\bash.exe
Found: D:\cygwin\bin\cat.exe
Found: D:\cygwin\bin\cpp.exe
Found: D:\cygwin\bin\find.exe
Found: c:\WINDOWS\COMMAND\find.exe
Warning: D:\cygwin\bin\find.exe hides c:\WINDOWS\COMMAND\find.exe
Found: D:\cygwin\bin\gcc.exe
Found: D:\cygwin\bin\gdb.exe
Found: D:\cygwin\bin\ld.exe
Found: D:\cygwin\bin\ls.exe
Found: D:\cygwin\bin\make.exe
Found: D:\cygwin\bin\sh.exe

   19k 2002/02/20 D:\cygwin\bin\cyggdbm.dll - os=4.0 img=1.0 sys=4.0
                  "cyggdbm.dll" v0.0 ts=2002/2/19 19:05
   22k 2001/12/13 D:\cygwin\bin\cygintl-1.dll - os=4.0 img=1.0 sys=4.0
                  "cygintl-1.dll" v0.0 ts=2001/12/13 1:28
                  "cygintl-1.dll" v0.0 ts=2001/12/13 1:28
   45k 2001/04/25 D:\cygwin\bin\cygform5.dll - os=4.0 img=1.0 sys=4.0
                  "cygform5.dll" v0.0 ts=2001/4/24 22:28
   26k 2001/04/25 D:\cygwin\bin\cygmenu5.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu5.dll" v0.0 ts=2001/4/24 22:27
  156k 2001/04/25 D:\cygwin\bin\cygncurses++5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++5.dll" v0.0 ts=2001/4/24 22:29
  226k 2001/04/25 D:\cygwin\bin\cygncurses5.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses5.dll" v0.0 ts=2001/4/24 22:17
   15k 2001/04/25 D:\cygwin\bin\cygpanel5.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel5.dll" v0.0 ts=2001/4/24 22:27
   35k 2002/01/09 D:\cygwin\bin\cygform6.dll - os=4.0 img=1.0 sys=4.0
                  "cygform6.dll" v0.0 ts=2002/1/8 22:03
   20k 2002/01/09 D:\cygwin\bin\cygmenu6.dll - os=4.0 img=1.0 sys=4.0
                  "cygmenu6.dll" v0.0 ts=2002/1/8 22:03
  175k 2002/01/09 D:\cygwin\bin\cygncurses++6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses++6.dll" v0.0 ts=2002/1/8 22:03
  202k 2002/01/09 D:\cygwin\bin\cygncurses6.dll - os=4.0 img=1.0 sys=4.0
                  "cygncurses6.dll" v0.0 ts=2002/1/8 22:03
   12k 2002/01/09 D:\cygwin\bin\cygpanel6.dll - os=4.0 img=1.0 sys=4.0
                  "cygpanel6.dll" v0.0 ts=2002/1/8 22:03
   17k 2001/06/28 D:\cygwin\bin\cyghistory4.dll - os=4.0 img=1.0 sys=4.0
                  "cyghistory4.dll" v0.0 ts=2001/1/6 20:34
  108k 2001/06/28 D:\cygwin\bin\cygreadline4.dll - os=4.0 img=1.0 sys=4.0
Cygwin Package Information
Last downloaded files to: C:\WINDOWS\Desktop\download\softwares
Last downloaded files from:
ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/sources.
redhat.com/cygwin

Package             Version
_update-info-dir    00077-1
ash                 20020731-1
autoconf            2.53b-1
autoconf-devel      2.53a-1
autoconf-stable     2.13-4
automake            1.6.2-1
automake-devel      1.6.2-1
automake-stable     1.4p5-5
base-files          1.0-1
base-passwd         1.0-1
bash                2.05b-5
binutils            20020706-2
cygwin              1.3.14-1
diff                1.0-1
diff                1.0-1
diffutils           2.8.1-1
fileutils           4.1-1
findutils           4.1.7-4
gawk                3.1.1-5
gcc                 3.2-1
gcc-mingw           3.2-20020817-1
gcc2                2.95.3-10
gdb                 20010428-3
gdbm                1.8.0-4
grep                2.5-1
groff               1.17.2-1
gzip                1.3.3-4
less                374-1
libiconv2           1.8-2
libintl1            0.10.40-1
libintl2            0.11.5-1
libltdl3            20020705-2
libncurses5         5.2-1
libncurses6         5.2-8
libreadline4        4.1-2
libreadline5        4.3-2
libtool             20020705-1
libtool-devel       20020705-2
libtool-stable      1.4.2-2
login               1.4-4
m4                  0.0
make                3.79.1-7
man                 1.5g-2
mingw-runtime       2.2-1
mktemp              1.4-1
more                2.11o-1
ncurses             5.2-8
opengl              1.1.0-6
pcre                3.7-1
perl                5.6.1-2
readline            4.3-2
sed                 3.02-1
sh-utils            2.0-2
tar                 1.13.25-1
termcap             20020930-1
terminfo            5.2-3
texinfo             4.2-4
textutils           2.0.21-1
w32api              2.0-1
which               1.5-1
zlib                1.1.4-1

Anyone can tell me how I can fix these errors..

Thanks,
Alfred

----- Original Message -----
From: Harig, Mark A. <maharig@idirect.net>
To: Alfred Lam <alfredlam@nowmediatech.com>; <cygwin@cygwin.com>
Sent: Wednesday, October 30, 2002 8:33 AM
Subject: RE: undefined reference continues


>
> As requested at http://cygwin.com/bugs.html,
> please include the output of 'cygcheck -s -v -r'
> (as an attachment).  This will provide anyone
> looking at your question with information
> such as which version of Cygwin you are
> running and which version of gcc you
> have installed.
>
> > -----Original Message-----
> > From: Alfred Lam [mailto:alfredlam@nowmediatech.com]
> > Sent: Wednesday, October 30, 2002 9:59 PM
> > To: cygwin@cygwin.com
> > Subject: undefined reference continues
> >
> >
> > Hi all,
> >
> > I have been trying for 4 days already and I'm getting the
> > same undefined
> > reference to ....
> >
> > I have tried the same command with the same program on Linux and it is
> > working, but on cygwin, it's not.. Can anyone help me.. This
> > is what I did :
> >
> > My windows pc is win98. The program is that of smart card
> > where I use ctapi
> > library. I'm trying to produce a .so file so that it can be
> > used in a jni
> > link which will be used in a java program. I have tried this
> > on my linux
> > machine. I have also tried libtool but to no end
> >
> > gcc main.o -L. -lctapi -o main.so where ctapi is libctapi.a
> > and I tried the
> > same in cygwin, but I always get undefined reference e.g
> > $ gcc main.o -L. -lctapi -o main.so
> > >main.o(.text+0x4b):main.c: undefined reference to `CT_init'
> > >main.o(.text+0x8d):main.c: undefined reference to `CT_close'
> > >main.o(.text+0x127):main.c: undefined reference to `CT_data'
> > >main.o(.text+0x1eb):main.c: undefined reference to `CT_data'
> > >main.o(.text+0x34d):main.c: undefined reference to `CT_data'
> > >collect2: ld returned 1 exit status
> > >
> > >I have also tried using ctapi.lib instead of libctapi.a, used main.c
> > instead of main.o, put the library first, try to create
> > main.exe instead of
> > main.so , but to no avail. Did I go wrong somewhere?
> > Can someone help me please...
> >
> > Thanks,
> > Alfred
> >
> >
> >
> > --
> > Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> > Bug reporting:         http://cygwin.com/bugs.html
> > Documentation:         http://cygwin.com/docs.html
> > FAQ:                   http://cygwin.com/faq/
> >
> >


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list