DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: help with C......  (Read 6,049 times)

dtrud0h

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 55
help with C......
« on: September 26, 2005, 02:29 AM »
I have just installed a linux on my desktop box (pclinuxOS)[ which is really well put together ] and I've been trying to compile an ip updater for dyndns.
the
Code
./configure
part goes ok and shows no errors, but when i run
Code
make
I get the following
Code
gcc  -g -O2  -o ez-ipupdate  ez-ipupdate.o conf_file.o md5.o cache_file.o pid_file.o
conf_file.o(.text+0x270): In function `parse_conf_file':
/root/Desktop/exip/ez-ipupdate-3.0.11b7/conf_file.c:88: undefined reference to `errno'
collect2: ld returned 1 exit status
make: *** [ez-ipupdate] Error 1
error encountered
using "kedit" line 88 looks like this
Code
 {
      fprintf(stderr, "could not open config file \"%s\":%s\n", fname, error_string);
      return(-1);
    }
I've said it before that I'm no coder so I have also included the conf_file.c as an attachment.(remove the .txt for the raw conf_file.c)
If any of you REALcoders can figure this out and maybe a brief description of what I am actually looking for it would be great.
BTW:  I didn't know where else to turn and this was the only place I could think of, feel free to use the dc messages to reply, or e-mail at dtrud0h@yahoo.com if the forum isn't the right place to do it. thanks again forum.
<- I have nothing witty to put here ->

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: help with C......
« Reply #1 on: September 26, 2005, 02:41 AM »
it's a little hard to help with this over forum, but from looking at the file, it looks like your configure is not quite detecting what it should.

at the top of your config_file.c youll see this:

Quote
#if HAVE_STRERROR
extern int errno;
#  define error_string strerror(errno)
#elif HAVE_SYS_ERRLIST
extern const char *const sys_errlist[];
extern int errno;
#  define error_string (sys_errlist[errno])
#else
#  define error_string "error message not found"
#endif

so basically its looking for some special flags that tell it whether your compiler/OS knows about errno or not.
configure is supposed to set these - but it looks like its telling your compiler that it DOES know about errno, and then your compiler doesnt really know about it (or alternatively the wrong header files are not being included).

SO, there are a couple ways you might fix it more properly, but you could try a quick fix just to see what happens if you try changing
#if HAVE_STRERROR
to
#if HAVE_STRERROR_DISABLETEST

and
#elif HAVE_SYS_ERRLIST
to
#elif HAVE_SYS_ERRLIST_DISABLETEST

that will just tell it to not try to use errno in that file; if you get further errors in further files youll have to find a more proper solution.
ideally the best solution would be to find the header files defining errno if your system supports it or figure out how to get configure to properly detect your system config better.

Original address: https://www.donationcoder.com/forum/index.php?topic=988.0