Problems with function/header file, Undefined symbol

Discussion in 'C Programming' started by Travis Stewart, Jul 29, 2003.

  1. Hi,
    I've been working on some software to control an older GPIB
    card for the past couple of weeks. I have function prototypes in a
    header file pc-mate2.h and the functions are defined in pc-mate2.c. I
    am using the Borland Turbo C 2.01 compiler (it is the compiler that
    the person I am writing this for uses) and when I compile the program
    I am writing I get an error:

    Turbo Link Version 2.0 Copyright (c) 1987, 1988 Borland
    International
    Undefined symbol '_readByte' in module enter2.c

    a very similar error occurs if I try to compile with gcc. These
    errors are strange as last year when they were first written these
    problems did not occur.

    I've made sure the header file is in my include directory, and that
    the proper #include statements in pc-mate2.c where readByte is
    defined, as well as the program I am writing that utilizes (at this
    time I have other functions that are in pc-mate2.c commented out as
    they cause the same error). I was wondering if anyone might have an
    idea why this is happening.

    Thanks for any help,
    Travis
    Travis Stewart, Jul 29, 2003
    #1
    1. Advertising

  2. Travis Stewart

    Malcolm Guest

    "Travis Stewart" <> wrote in message
    >
    > Turbo Link Version 2.0 Copyright (c) 1987, 1988 Borland
    > International
    > Undefined symbol '_readByte' in module enter2.c
    >

    The linker, not the compiler, is producing this error. What it means is that
    it can't find the function body for _readByte(). If the function is a
    library function you need to tell the linker to link the library, if you
    wrote it you need to include the object file in which it resides.

    I have occasionally been trapped by the leading underscore nonsense.
    Sometimes adding the underscore to the function when it is called will allow
    it to link properly, even though it is documented without the underscore.
    Malcolm, Jul 29, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. baumann@pan
    Replies:
    1
    Views:
    730
    Richard Bos
    Apr 15, 2005
  2. Replies:
    1
    Views:
    984
    Jack Klein
    Dec 22, 2006
  3. Will hunting
    Replies:
    2
    Views:
    439
    Will hunting
    Jan 4, 2007
  4. mlt
    Replies:
    2
    Views:
    816
    Jean-Marc Bourguet
    Jan 31, 2009
  5. Song Ma
    Replies:
    2
    Views:
    220
    Charles Oliver Nutter
    Jul 20, 2008
Loading...

Share This Page