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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:57:29+00:00 2026-05-13T06:57:29+00:00

I have a C program which compiles and runs fine under Linux without any

  • 0

I have a C program which compiles and runs fine under Linux without any warnings, but when trying to compile it on SunOS, I get the following warning:

test.c: In function `my_function':
test.c:412: warning: implicit declaration of function `strerror_r'
Undefined                       first referenced
 symbol                             in file
strerror_r                          /var/tmp/ccRiPoGl.o
ld: fatal: Symbol referencing errors. No output written to test
collect2: ld returned 1 exit status
make: *** [test] Error 1

Any ideas?

  • 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-13T06:57:30+00:00Added an answer on May 13, 2026 at 6:57 am

    The “implicit declaration” warning is telling you that none of the headers you have #included have defined that function, and the “undefined symbol” warning is telling you that the function itself isn’t defined in any of the libraries that you’re linking in.

    Taken together, this implies that C library you’re compiling against doesn’t provide the strerror_r function. You’ll have to roll your own alternative.

    For example, if you’re using pthreads, you could do this:

    int my_strerror_r(int errnum, char *buf, size_t buflen)
    {
        static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
    
        if (!buflen)
        {
            errno = ENOSPC;
            return -1;
        }
    
        buf[0] = 0;
    
        pthread_mutex_lock(&strerror_lock);
        strncat(buf, strerror(errnum), buflen - 1);
        pthread_mutex_unlock(&strerror_lock);
    
        return 0;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge haskell file which compiles and runs without any problem. I
I have an MPI program which compiles and runs, but I would like to
I have a ATL COM service exe (MyService.exe), which compiles and runs fine. If
I have a program which runs an external, command line utility and reads the
I have a program which runs on a console and its Umlauts and other
I have the following code which assembles and runs fine on Windows XP 32
I have an iPhone app that compiles and runs fine in the Simulator on
A CLI program of mine compiles and runs fine on windows. Compiles fine on
The situation is simple, but strange. When i compile my program without the LinearAlgebra.o
I have a program which creates JButtons which are then added to a JPanel

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.