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 8870065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:37:49+00:00 2026-06-14T17:37:49+00:00

I am trying to compile an example C program and link it to some

  • 0

I am trying to compile an example C program and link it to some static library files using:

gcc -I /usr/local/include -L /usr/local/lib -l libsundials_cvode.a -l libsundials_nvecserial.a cvRoberts_dns.c -o cvRoberts_dns.o

(I am sure that the library files and include files directories above are correct.)

The error I get is:

/usr/bin/ld: cannot find -llibsundials_cvode.a
collect2: ld returned 1 exit status

I have two questions:

1) Am using the -L and -l options correctly?

2) The above error is b/c gcc is looking for the library file in the wrong location right? I tried to fix this by setting $LD_LOAD_PATH via my terminal to /usr/local/bin. I still get the above error. How do I fix this?

Thanks!

-Rohan.

  • 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-06-14T17:37:50+00:00Added an answer on June 14, 2026 at 5:37 pm

    Try -lsundials_cvode instead – delete the ‘lib’ and ‘.a’ parts

    Note that LD_LOAD_PATH is for locating dynamic libraries at run-time, not during compilation.

    Edit:

    I just tried that. The change addresses the cannot find library error but 
    now I am faced with many "undefined reference to" errors. Does this mean 
    the linking of the library files has failed somehow? How do I correct this? 
    

    It means that there are other symbols that need to be resolved that are not in the library you linked. Note that you need to change both libraries (you have two on the command line). Also perhaps they are in the wrong order.

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

Sidebar

Related Questions

I'm trying to compile an example program that links to the shared library produced
I'm trying to compile the following simple DL library example code from Program-Library-HOWTO with
I'm trying to compile the zpipe.c example in my Linux(Ubuntu 8.04) with gcc, but
When trying to compile this code: #include <iostream> #include <vector> using namespace std; class
While trying to compile a 64 bit linux kernel using gcc, I see the
I'm trying to compile a block of example code using Thrust in an attempt
I am trying to compile then execute the Leptonica example program colorquant_reg.c Facts: OS:
I am trying to compile a program which uses udis86 library. Actually I am
I'm trying to compile Example of a C program embedding ECL with callbacks to
I am just trying to compile some simple example code I typed in from

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.