topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Tuesday March 19, 2024, 2:58 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: help with C......  (Read 4287 times)

dtrud0h

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 55
    • View Profile
    • Rant-Zone
    • Donate to Member
help with C......
« on: September 25, 2005, 09:29 PM »
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
./configure
part goes ok and shows no errors, but when i run
make
I get the following
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
{
      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 [email protected] 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,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: help with C......
« Reply #1 on: September 25, 2005, 09:41 PM »
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:

#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.