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

  • SEARCH
  • Home
  • 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 6656351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:37:57+00:00 2026-05-26T01:37:57+00:00

I am trying to use an external library called iniparser in my C program.

  • 0

I am trying to use an external library called iniparser in my C program. I’m using gcc 4.4.

I put the iniparser library in a subdirectory called lib/ header files are in lib/iniparser/src and the library is compiled to lib/iniparser/libiniparser.so.0.

I wrote a short Makefile to compile it, here’s the output of make:

gcc -Wall -Wextra -Werror -c -I include/ src/smag_main.c -L lib/iniparser -liniparser -I lib/iniparser/src
gcc -Wall -Wextra -Werror -c -I include/ -L lib/iniparser -liniparser -I lib/iniparser/src src/agros.c
gcc -Wall -Wextra -Werror -c -I include/ -L lib/iniparser -liniparser -I lib/iniparser/src src/main.c
gcc -Wall -Wextra -Werror -L lib/iniparser -liniparser -o agros smag_main.o main.o agros.o
smag_main.o: In function `sec_haskey':
smag_main.c:(.text+0xa9): undefined reference to `iniparser_find_entry'
smag_main.o: In function `parse_config':
smag_main.c:(.text+0x153): undefined reference to `iniparser_load'
smag_main.c:(.text+0x18b): undefined reference to `iniparser_getint'
smag_main.c:(.text+0x1c6): undefined reference to `iniparser_getstring'
smag_main.c:(.text+0x202): undefined reference to `iniparser_getstring'
smag_main.c:(.text+0x261): undefined reference to `iniparser_getstring'
smag_main.c:(.text+0x2c2): undefined reference to `iniparser_getint'
smag_main.c:(.text+0x2d5): undefined reference to `iniparser_freedict'
collect2: ld returned 1 exit status
make: *** [agros] Error 1

First call to gcc compiles smag_main.o successfully, the second one compiles agros.o and the third one main.o. The 4th call is the linker, that will link all those objects into an executable agros. It obviously fails.

It looks like it has problems locating iniparser.so at linking time. How’s my call wrong?
I am confused.

(Alternate question, if anyone could explain how to the linking by calling ld directly it would be great).

  • 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-26T01:37:58+00:00Added an answer on May 26, 2026 at 1:37 am

    Try putting a symlink from libiniparser.so.0 to libiniparser.so

     cd lib/iniparser/
     ln -s libiniparser.so.0 libiniparser.so
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use an external library (wingraph) in a simple program. I have
I'm trying to use an external library DevExpress.XtraTreeList.v8.1.dll in my vsto office addin built
I am trying to use some external Framework in my iPhone app. I did
I'm trying to work out how to use ocamlfind to compile a C library
I'm trying to develop an external library (not sure if that's the right term)
I'm trying to use libjasper from http://www.ece.uvic.ca/~frodo/jasper/ as a static library in compiling dcraw.c
I am using VS 2008. I have Library 5 Lib file A.lib B.lib C.lib
I'm trying to use a static library created by me in Visual C++ 2005
I am trying to wrap an external library in more idiomatic Clojure. This includes
I'm trying to use PhysFS in my C++ game (using a C++ wrapper )

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.