Open MarrekNozka opened 2 years ago
I created this function in main.c:
main.c
uint16_t foo(void) { static uint16_t x = 20; return x += 91; }
and I got this error message:
sdcc-gas src/main.c -DSTM8S208 -mstm8 --out-fmt-elf -c --debug --opt-code-size --asm=gas --function-sections --data-sections -Iinc/ -MM > obj/main.d sdcc-gas src/main.c -DSTM8S208 -mstm8 --out-fmt-elf -c --debug --opt-code-size --asm=gas --function-sections --data-sections -Iinc/ -o obj/main.o src/main.c:14: warning 126: unreachable code obj/main.asm: Assembler messages: obj/main.asm: Error: can't resolve `.text._main' {.text._main section} - `.Lmain_foo_17' {.text._foo section} make: *** [Makefile:63: obj/main.o] Chyba 1 rm obj/main.d
What is the right way to initialize static variable? Thanks.
I created this function in
main.c
:and I got this error message:
What is the right way to initialize static variable? Thanks.