undefine sysbol comm_init(int)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dubes
    New Member
    • Nov 2010
    • 4

    undefine sysbol comm_init(int)

    i use borland c programing for adam-4500. My code:
    #include"adam45 00.h"
    void main(void)
    {
    if (!comm_init (1000))
    {
    printf(" initialization failed!");
    delay(1000);
    exit();
    }
    }
    i took all files into example1 directory : inc and lib directories of turbo c, and adam4500.h header file . when i compile it not error and not warring, but when i build all it has one error :
    linker error: undefined symbol comm_init(int) in module TIEP.CPP
    can you help me repair this error!
  • mac11
    Contributor
    • Apr 2007
    • 256

    #2
    The linker can't find the code to link for the comm_init function. Where's the code for it? Is it supposed to come from adam4500? If so, maybe you need to make sure it's being compiled and linked in (and not just #included).

    Otherwise, if the function is in a different file you need to #include and compile/link it.

    Comment

    • dubes
      New Member
      • Nov 2010
      • 4

      #3
      yes, adam4500.h isn't a header file of borland c. I have linked to the directory containing the header files . but this error msg still appear.

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        The header files only tell the compiler that the functions exist, the contain declarations of the function. The linker will need the definition (the actual code) of the function.

        If you have a header file (adam4500.h) containing the function declaration then you should also have a library (.lib or .a) or possibly an object (.o or .obj) containing the definition of the function that needs to be supplied to the linker.

        Comment

        • dubes
          New Member
          • Nov 2010
          • 4

          #5
          thank you.i added all .lib files of adam into directory and linked to that directory. but error message still appear. i don't know how i should do.

          Comment

          • Banfa
            Recognized Expert Expert
            • Feb 2006
            • 9067

            #6
            Look up the documentation of that function and see which library it says you need to use.

            Comment

            • dubes
              New Member
              • Nov 2010
              • 4

              #7
              yes, i looked up and added library that i need to use into directory. but still not right. so i added all file in library of adam. and the result remain the same.

              Comment

              • Banfa
                Recognized Expert Expert
                • Feb 2006
                • 9067

                #8
                You do not need to add the libraries to your source directory, you should leave them where they were installed.

                You need to add the libraries (and possibly a library path) to your linker command.

                Comment

                Working...