Witam serdecznie, mam problem z prostym zastosowaniem plików nagłówkowych.
Cały czas wyskakują błędy przy poniższym kodzie:
/*
* led.h
*
* Created on: 12 lut 2016
* Author: Marcin
*/
#ifndef LED_H_
#define LED_H_
#define LED_PORT B
#define LED 6
#endif /* LED_H_ */
/*
* led.c
*
* Created on: 12 lut 2016
* Author: Marcin
*/
#include "led.h"
DDR(LED_PORT) |= (1<<LED);
PORT(LED_PORT) |= (1<<LED);
W czym leży problem?
Dodano po 31 [sekundy]:
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega32 -DF_CPU=8000000UL -MMD -MP -MF"led.d" -MT"led.o" -c -o "led.o" "../led.c"
../led.c:10:1: warning: return type defaults to 'int' [enabled by default]
DDR(LED_PORT) |= (1<<LED);
^
../led.c: In function 'DDR':
../led.c:10:15: error: expected declaration specifiers before '|=' token
DDR(LED_PORT) |= (1<<LED);
^
../led.c:11:1: error: expected declaration specifiers before 'PORT'
PORT(LED_PORT) |= (1<<LED);
^
../led.c:10:1: warning: type of 'B' defaults to 'int' [enabled by default]
DDR(LED_PORT) |= (1<<LED);
^
../led.c:11:1: error: expected '{' at end of input
PORT(LED_PORT) |= (1<<LED);
^
../led.c:11:1: warning: control reaches end of non-void function [-Wreturn-type]
PORT(LED_PORT) |= (1<<LED);
^
make: *** [led.o] Błąd 1
23:26:03 Build Finished (took 308ms)
Cały czas wyskakują błędy przy poniższym kodzie:
/*
* led.h
*
* Created on: 12 lut 2016
* Author: Marcin
*/
#ifndef LED_H_
#define LED_H_
#define LED_PORT B
#define LED 6
#endif /* LED_H_ */
/*
* led.c
*
* Created on: 12 lut 2016
* Author: Marcin
*/
#include "led.h"
DDR(LED_PORT) |= (1<<LED);
PORT(LED_PORT) |= (1<<LED);
W czym leży problem?
Dodano po 31 [sekundy]:
avr-gcc -Wall -Os -fpack-struct -fshort-enums -ffunction-sections -fdata-sections -std=gnu99 -funsigned-char -funsigned-bitfields -mmcu=atmega32 -DF_CPU=8000000UL -MMD -MP -MF"led.d" -MT"led.o" -c -o "led.o" "../led.c"
../led.c:10:1: warning: return type defaults to 'int' [enabled by default]
DDR(LED_PORT) |= (1<<LED);
^
../led.c: In function 'DDR':
../led.c:10:15: error: expected declaration specifiers before '|=' token
DDR(LED_PORT) |= (1<<LED);
^
../led.c:11:1: error: expected declaration specifiers before 'PORT'
PORT(LED_PORT) |= (1<<LED);
^
../led.c:10:1: warning: type of 'B' defaults to 'int' [enabled by default]
DDR(LED_PORT) |= (1<<LED);
^
../led.c:11:1: error: expected '{' at end of input
PORT(LED_PORT) |= (1<<LED);
^
../led.c:11:1: warning: control reaches end of non-void function [-Wreturn-type]
PORT(LED_PORT) |= (1<<LED);
^
make: *** [led.o] Błąd 1
23:26:03 Build Finished (took 308ms)
