Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6115795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:07:58+00:00 2026-05-23T15:07:58+00:00

I’m having trouble compiling some code against ocilib (libocilib.a) on version 3.9.0: $ ls

  • 0

I’m having trouble compiling some code against ocilib (libocilib.a) on version 3.9.0:

$ ls
libocilib.a ocilib.h test.c

$ gcc -o test -L. -locilib test.c
/tmp/cc4071VP.o: In function
`main’:
test.c:(.text+0x27):
undefined reference to
OCI_Initialize
test.c:(.text+0x64): undefined
reference to OCI_ConnectionCreate
test.c:(.text+0x9d): undefined
reference to OCI_StatementCreate
test.c:(.text+0xaf): undefined
reference to OCI_ExecuteStmt
test.c:(.text+0xb8): undefined
reference to OCI_GetResultset
test.c:(.text+0xcc): undefined
reference to OCI_GetString
test.c:(.text+0xdd): undefined
reference to OCI_FetchNext
test.c:(.text+0xe6): undefined
reference to OCI_Cleanup
collect2:
ld returned 1 exit status

Ok. In that case:

$ strings libocilib.a | grep
OCI_Initialize
OCI_Initialize
OCI_Initialize
OCI_Initialize
OCI_Initialize

There was a solution to this problem answered by the man (vince) himself on another page, but it isn’t working for me.

What DOES work is when I try to compile against an .so:

$ ls
libocilib.so*
libocilib.so.3* libocilib.so.3.9.0*
ocilib.h test.c

$ gcc -o test -L. -locilib test.c
$

The program runs as expected as well (after modifying LD_LIBRARY_PATH, of course!).

The solution mentioned earlier includes some defines -DOCI_IMPORT_LINKAGE and -DOCI_CHARSET_ANSI I’ve tried with both of these (even though the online docs say that DOCI_IMPORT_LINKAGE is only used while compiling the library itself. I had assumed that pertains more to the linking of the actual oracle libs than it does ocilib. It was tried, none the less.

Speaking of which, if it helps to answer the question, I compiled the library to have runtime linking, having passed the --with-oracle-import=runtime flag into ./configure.

One more side note, something similar happens on Windows 32-bit. No problems with Windows 64. I can link and run a program against my own compiled libocilib.lib just fine.

Hopefully I’ve provided enough clues… anyone know what I’m doing wrong?
Thanks in advance help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:07:59+00:00Added an answer on May 23, 2026 at 3:07 pm

    Have you tried linking it like this?

    gcc -o test test.c -L. -locilib
    

    At least in the past (I haven’t done much C/C++ in a long time) the order of linking mattered.
    test.o would have references to OCI_Initialize and with libocilib.a after test.o, those would be satisfied. But if you linked the other way around those references would not be satisfied because the linker saw the OCI_Initialize symbol before it looked at test.o and so never realized it needed to keep a “pointer” to the symbol around when looking at test.o.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have some data like this: 1 2 3 4 5 9 2 6
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.