Thread: Unsatisified Symbols Error

  1. #1
    Registered User deadpoet's Avatar
    Join Date
    Jan 2004
    Posts
    50

    Question Unsatisified Symbols Error

    I am getting an Unsatisfied symbols error. Can one of the more experienced members please shed some light on what I am doing wrong and what I need to do to fix it.

    Build Error:
    Code:
    # PROJECT ioconfig_info
    # Building Target: iomain
    # ENV vars set: COMPFLAGS_LD_iomain=-g0  , COMPFLAGS_CXX_iomain=-g0 -O -y
            aCC -c  -g0 -O -y   -o iomain.o iomain.cc
    aCC: current directory is "/build/nitro_project/ioconfig-info"
    Linking iomain ...
    aCC  -g0   -o iomain iomain.o
    aCC: current directory is "/build/nitro_project/ioconfig-info"
    /usr/ccs/bin/ld: Unsatisfied symbols:
       io_search (first referenced in iomain.o) (code)
    *** Error exit code 1
    Stop.
    Non-Zero status from child process.
    # PROJECT ioconfig_info BUILD-TARGET Failed
    Stripped Down iomain.cc:
    Code:
    #include <cstdlib>
    #include <iostream.h>
    #include <stdio.h>
    #include <string.h>
    #include <unistd.h>
    #include <fcntl.h>
    #include <errno.h>
    #include <sys/ioctl.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    
    #ifdef __cplusplus
    #define class ioclass
    extern "C" {
      //#endif
    #include "/usr/include/sys/ioparams.h"
      //#ifdef __cplusplus
      void *io_search __( ( void *token, int type, int qual, ...) );
      void *io_search_array __( ( void *token, int type, int qual, char *key[], void *dat[] ) );
      int io_query __( ( void *token, int type, char *key, void *ptr ) );
      int io_get_key_info __( ( int type, char *key, char *type_name, int *size ) );
    };
    #endif
    
    int main( void ) {
    
        void *token;
        token = NULL;
        token = io_search (token, S_IOTREE, Q_HW, "class", "disk", NULL );
    
    // more code here ...
    
        exit ( 0 );
    
    }
    Snip-it from ioparams.h

    Code:
    ...
    
    #ifdef _KERNEL
    /* External function prototype declarations */
    extern void *io_search __( ( void *token, int type, int qual, ... ) );
    extern void *io_search_array __( ( void *token, int type, int qual, char *key[], void *dat[] ) );
    extern int io_query __( ( void *token, int type, char *key, void *ptr ) );
    extern int io_get_key_info __( ( int type, char *key, char *type_name, int *size ) );
    #endif /* _KERNEL */
    Am I defining the external functions in iomain.cc correctly or am I just calling them wrong?

    Thanks In Advance For Any And All Help,

    DeadPoet

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    The linker cannot find the "implementation" of io_search.

    >> #define class ioclass
    That's not good.

    gg

  3. #3
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    You are calling io_search() but don't have it defined anywhere is my guess. At least it's not in anything you posted.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well the #ifdef _KERNEL suggests that you shouldn't be using these functions from user-land programs anyway.

    This is just plain wrong.
    #include "/usr/include/sys/ioparams.h"
    //#ifdef __cplusplus
    void *io_search __( ( void *token, int type, int qual, ...) );

    Copying the prototypes from the header file just because the conditional compilation guard prevented you from accessing them in the first place.

    The imaginary command would be
    aCC -g0 -o iomain iomain.o -lkernel
    where you specify the name of the appropriate library.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  5. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 10:03 AM