1. (error) unresolved symbols
Apply new function in gpio.c to main.c
Have below error:
(error) unresolved symbols: 1
_GPIO_init_output from main.c.1.o
This error often means that some function has a declaration, but not a definition.
The issue could be that you are including a header file, which brings in some function declarations, but you either:
- do not define the functions in your cpp file (if you wrote this code yourself)
- do not include the lib/dll file that contains the definitions
If in C++, may be
A common mistake is that you define a function as a standalone and forget the class selector, e.g. A::
, in your .cpp file:
Reference:
https://stackoverflow.com/questions/9928238/unresolved-external-symbol-in-object-files
2. ARMCC: Error #268: declaration may not appear after executable state
除了要記得在header 檔先declare function, 並且在C檔中 include header 檔之外(路徑需找的到)
C90中規定變數的定義必須在可執行的函數之前
In C90, all variable declarations must happen before any executable statements in a function or other code block.
The compiler error message mentions the line number of the offending line of code.
Reference: