unresolved extern

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shoonya
    New Member
    • May 2007
    • 160

    unresolved extern

    hi,

    there is a function defined in
    abc.c
    and prototype is present in abc.h

    i want to call this function from another module, so i included the abc.h file along with correct path, but tehn also it's giving the error
    unresolved external symbol foo referenced in function another_functio n
  • donbock
    Recognized Expert Top Contributor
    • Mar 2008
    • 2427

    #2
    This looks like a linker error, not a compiler error. How you resolve this is specific to your compiler/IDE.

    (Assume that the other module you mention is called def.c)

    For example, if you were using Gnu C on unix you might issue this command:
    > gcc -o myprogram abc.c def.c

    or this sequence of commands:
    > gcc -c abc.c
    > gcc -c def.c
    > gcc -o myprogram abc.o def.o

    The error you reported suggests that the linker was not told to include abc.o.

    Comment

    • shoonya
      New Member
      • May 2007
      • 160

      #3
      thanks donbock

      I am using Microsoft visual studio

      shoonya

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Shoonya: Is this a compiler generated error or a linker generated error?

        If the error starts with C it is a compiler error. If it starts with L it is a linker error.

        It's important to know what kind of error it is. Maybe you could post a piece of what you are doing along wuth the error you are getting.

        Comment

        • shoonya
          New Member
          • May 2007
          • 160

          #5
          thanks weaknessforcats

          the problem is solved now,
          1>
          i was not mentioning the function in the .def file [where functions that needs to be exported are kept]

          2>
          I was not including the location of library [.lib file] of the other module

          and it was linking error

          Shoonya

          Comment

          Working...