This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL

I am trying to compile the following code, but i get the error

*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
SYMBOL: _HALSETPORTBIT
MODULE: program1.obj (PROGRAM1)
ADDRESS: 0822H

this is just for one function i am using i get the for all the function in the code.
The sample programs work just fine, and i have included all the header files needed.

#include <chipcon/hal.h>
#include <stdio.h>

main()
{

	halSetPortBitDir(1, 2, POUT);
		while (TRUE)
		{
			halSetPortBit(0, 2, TRUE);
			halWait(200, 14746);
			halSetPortBit(1, 2, FALSE);
		}
}

Parents
  • "Yes i have included the CHIPCON header files needed."

    I know, but I was asking about whether or not you had incorporated the appropriate Chipcon library files in your build, not the header files.

    "In this case all the functions are defind in the hal.h header file."

    Not exactly. The macros are defined, whereas the external functions are declared in the header file. That means that the actual functions are defined elsewhere. Those functions are defined in separate C source files, which you must explicitly compile and link in with your project, or simply include the appropriate library in your project to link against (e.g., halLib_small.LIB or halLib_small.LIB). Including hal.h in program1.c only publishes the function names and interfaces. The actual implementation of those functions is in the libraries.

Reply
  • "Yes i have included the CHIPCON header files needed."

    I know, but I was asking about whether or not you had incorporated the appropriate Chipcon library files in your build, not the header files.

    "In this case all the functions are defind in the hal.h header file."

    Not exactly. The macros are defined, whereas the external functions are declared in the header file. That means that the actual functions are defined elsewhere. Those functions are defined in separate C source files, which you must explicitly compile and link in with your project, or simply include the appropriate library in your project to link against (e.g., halLib_small.LIB or halLib_small.LIB). Including hal.h in program1.c only publishes the function names and interfaces. The actual implementation of those functions is in the libraries.

Children