public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Sample makefile
@ 2002-11-01 13:14 Brunda Sathi
  2002-11-01 14:16 ` Peter A. Castro
  0 siblings, 1 reply; 5+ messages in thread
From: Brunda Sathi @ 2002-11-01 13:14 UTC (permalink / raw)
  To: cygwin

Hi,
     I am trying to compile an oracle oci sample program "cdemo81.c" which
is under
          d:\oracle\ora92\oci\samples directory. It is referring to a
library called oci.lib which is under
          d:\oracle\ora92\oci\lib\msvc directory.
     All include files are under d:\oracle\ora92\oci\include directory
     cygwin dev tools are under d:\cygwin\bin directory.

My question is how do I create a simple cdemo1.exe file by compiling and
linking (command line).

I tried following command
     D:\Oracle\ora92\oci\samples>gcc -c -Id:\oracle\ora92\oci\include
cdemo81.c

copilation was successful.

     I am trying to link using following command and I am unable to link to
oci.lib.

D:\Oracle\ora92\oci\samples>ld -o cdemo81 -ld:
\oracle\ora92\oci\lib\msvc\oci.lib c
demo81.o -lc

I am getting undefined reference all functions that are called from
oci.lib.

Thanks,
Brunda




--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sample makefile
  2002-11-01 13:14 Sample makefile Brunda Sathi
@ 2002-11-01 14:16 ` Peter A. Castro
  0 siblings, 0 replies; 5+ messages in thread
From: Peter A. Castro @ 2002-11-01 14:16 UTC (permalink / raw)
  To: Brunda Sathi; +Cc: cygwin

On Fri, 1 Nov 2002, Brunda Sathi wrote:

> Hi,
>      I am trying to compile an oracle oci sample program "cdemo81.c" which
> is under
>           d:\oracle\ora92\oci\samples directory. It is referring to a
> library called oci.lib which is under
>           d:\oracle\ora92\oci\lib\msvc directory.
>      All include files are under d:\oracle\ora92\oci\include directory
>      cygwin dev tools are under d:\cygwin\bin directory.
> 
> My question is how do I create a simple cdemo1.exe file by compiling and
> linking (command line).
> 
> I tried following command
>      D:\Oracle\ora92\oci\samples>gcc -c -Id:\oracle\ora92\oci\include
> cdemo81.c
> 
> copilation was successful.
> 
>      I am trying to link using following command and I am unable to link to
> oci.lib.
> 
> D:\Oracle\ora92\oci\samples>ld -o cdemo81 -ld:\oracle\ora92\oci\lib\msvc\oci.lib cdemo81.o -lc
> 
> I am getting undefined reference all functions that are called from oci.lib.

It would help if you provided the output from the linker so we can see
what's unresolved.  I'm a bit weary that this will work anyway.  Oracle's
OCI libraries were built using the MS Visual C++ environment.  As such,
it has references to things in the MSVCRT an expects to be run in that
environment.  I don't recall if gcc's linker can easily link with the
MSVCRT environment.  Perhaps Christopher can comment on this.

> Thanks,
> Brunda

-- 
Peter A. Castro <doctor@fruitbat.org> or <Peter.Castro@oracle.com>
	"Cats are just autistic Dogs" -- Dr. Tony Attwood



--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sample makefile
  2002-11-04  9:19 Brunda Sathi
@ 2002-11-04 10:21 ` Shankar Unni
  0 siblings, 0 replies; 5+ messages in thread
From: Shankar Unni @ 2002-11-04 10:21 UTC (permalink / raw)
  To: cygwin

On 11/4/2002 9:18 AM, Brunda Sathi wrote:
> Here is the output from the linker
> 
> D:\Oracle\ora92\oci\samples>ld -o cdemo81 cdemo81.o d:
> \oracle\ora92\oci\lib\msvc
> \oci.lib d:\oracle\ora92\oci\lib\msvc\msvcrt.lib -lc

Whoa. Why are you linking "msvcrt.lib"?

I suspect your problems are because you're mixing msvcrt (Microsoft 
Visual C(++) RunTime) and the Cygwin libc.

Try removing msvcrt.lib and see what comes up undefined. Perhaps a 
better bet would be to provide stubs for any undefined libc functions 
referenced from oci.lib that turn around and call the Cygwin libc 
equivalent.
--
Shankar.




--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sample makefile
@ 2002-11-04  9:56 lhall
  0 siblings, 0 replies; 5+ messages in thread
From: lhall @ 2002-11-04  9:56 UTC (permalink / raw)
  To: bsathi, cygwin

First, there's no reason to split up the compile and link step.  Do it
in one step unless you know that you need to do otherwise.  You'll generally
have less trouble.  BTW, you can skip '-lc' as well.  You get this by 
default.  That's true for '-lm' too.

So now you know you have undefined references.  Check the objects/libraries
that you're using and see if those symbols are in there.  If not, go looking
for the objects/libraries that do contain those symbols.  If you find the 
symbols but they look a little different (maybe they have @<some number> at
the end), then look up information about calling conventions at 
msdn.microsoft.com.  The information there should allow you to bridge the
gap.

Good luck,

Larry

Original Message:
-----------------
From: Brunda Sathi bsathi@telcordia.com
Date: Mon, 4 Nov 2002 12:18:25 -0500
To: cygwin@cygwin.com
Subject: Re: Sample makefile


Here is the output from the linker

D:\Oracle\ora92\oci\samples>ld -o cdemo81 cdemo81.o d:
\oracle\ora92\oci\lib\msvc
\oci.lib d:\oracle\ora92\oci\lib\msvc\msvcrt.lib -lc
cdemo81.o(.text+0xcf7):cdemo81.c: undefined reference to `_impure_ptr'
cdemo81.o(.text+0xd9a):cdemo81.c: undefined reference to `_impure_ptr'
cdemo81.o(.text+0x131f):cdemo81.c: undefined reference to `_impure_ptr'
d:\oracle\ora92\oci\lib\msvc\msvcrt.lib(build/intel/dll_obj/crtexe.obj)
(.text+0x
5e):crtexe.c: undefined reference to `_imp___adjust_fdiv'
d:\oracle\ora92\oci\lib\msvc\msvcrt.lib(build/intel/dll_obj/atonexit.obj)
(.text+
0xf):atonexit.c: undefined reference to `_imp___onexit'

Thanks,
Brunda


--
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/


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sample makefile
@ 2002-11-04  9:19 Brunda Sathi
  2002-11-04 10:21 ` Shankar Unni
  0 siblings, 1 reply; 5+ messages in thread
From: Brunda Sathi @ 2002-11-04  9:19 UTC (permalink / raw)
  To: cygwin

Here is the output from the linker

D:\Oracle\ora92\oci\samples>ld -o cdemo81 cdemo81.o d:
\oracle\ora92\oci\lib\msvc
\oci.lib d:\oracle\ora92\oci\lib\msvc\msvcrt.lib -lc
cdemo81.o(.text+0xcf7):cdemo81.c: undefined reference to `_impure_ptr'
cdemo81.o(.text+0xd9a):cdemo81.c: undefined reference to `_impure_ptr'
cdemo81.o(.text+0x131f):cdemo81.c: undefined reference to `_impure_ptr'
d:\oracle\ora92\oci\lib\msvc\msvcrt.lib(build/intel/dll_obj/crtexe.obj)
(.text+0x
5e):crtexe.c: undefined reference to `_imp___adjust_fdiv'
d:\oracle\ora92\oci\lib\msvc\msvcrt.lib(build/intel/dll_obj/atonexit.obj)
(.text+
0xf):atonexit.c: undefined reference to `_imp___onexit'

Thanks,
Brunda


--
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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-11-04 18:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-01 13:14 Sample makefile Brunda Sathi
2002-11-01 14:16 ` Peter A. Castro
2002-11-04  9:19 Brunda Sathi
2002-11-04 10:21 ` Shankar Unni
2002-11-04  9:56 lhall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).