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); } }
"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.
Hi Dan thanks a million for helping. You are right i hadnt included the C files which actually take care of the functions. i included all the C files for each function and now i am able to compile the program with out any warnings. Thanks a lot for bailing me out