Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.56/25: Рейтинг темы: голосов - 25, средняя оценка - 4.56
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112

Исправление ошибок в коде

20.04.2015, 15:26. Показов 5339. Ответов 19
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Компилятор находит ошибки , просьба помочь исправить ошибки в коде

C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/eeprom.h>
#include <avr/sleep.h>
#include <util/delay.h>
 
// the number of light states
#define NSTATES 4
// for when no key is pressed
#define KEY_NONE '@'
 
// stateDurations0 in eeprom, read on reset, written on change by user
const unsigned stateDurations0[NSTATES] EEMEM = {3, 1, 3, 1};
// state durations
unsigned stateDurations[NSTATES];
// light states, one hex digit per lights set
const unsigned lightStates[NSTATES] = {0x41, 0x23, 0x14, 0x32};
// current lights state
int state = 0;
// seconds left for state change
int secondsLeft = 3;
// bool, set by timer interrupt, read and cleared in main loop
int inputMode = 0;
 
// for keyboard debouncing
void ShortDelay()
{
_delay_ms(15);
}
 
// returns a pressed key code (digit, ascii '*' or '#') or KEY_NONE
char ReadKey()
{
static const char keyCodes[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, '*', 0, '#'};
for (unsigned col = 0, colMask = 1; col < 3; col++, colMask <<= 1)
{
PORTA = ~colMask;
for (unsigned row = 0, rowMask = 1; row < 4; row++, rowMask <<= 1)
if (!(PINC & rowMask))
return keyCodes[row * 3 + col];
}
return KEY_NONE;
}
 
char WaitAndReadKey()
{
char key;
while ((key = ReadKey()) == KEY_NONE)
;
return key;
}
 
void WaitForKeyUp()
{
while (ReadKey() != KEY_NONE)
;
}
 
ISR(TIMER1_COMPA_vect)
{
if (ReadKey() == '*')
inputMode = 1;
if (--secondsLeft == 0)
{
if (++state == NSTATES)
state = 0;
secondsLeft = stateDurations[state];
}
// lights
PORTD = lightStates[state];
// indicators
PORTB = secondsLeft / 10 << 4 | secondsLeft % 10;
}
 
int main(void)
{
// Disable stuff to reduce power consumption
ACSR |= 1 << ACD;
// load state durations
eeprom_read_block(stateDurations, stateDurations0, sizeof(stateDurations));
secondsLeft = stateDurations[0];
// output to lights
DDRD = 0xff;
// output to indicators
DDRB = 0xff;
// output to keypad
DDRA = 0x0f;
// input from keypad, enable pull-ups for all pins
PORTC = 0xff;
DDRC = 0x00;
// timer1: clk/1024, clear on compare
// make sure F_CPU is right
// multiply by 8 if prescaler is disabled
OCR1A = (F_CPU + 0.5) / 1024;
TCCR1B = 1 << WGM12 | 1 << CS12 | 0 << CS11 | 1 << CS10;
TIMSK1 = 1 << OCIE1A;
sei();
while (1)
{
if (!inputMode)
{
// idle mode, io clock is still active
set_sleep_mode(SLEEP_MODE_IDLE);
sleep_mode();
continue;
}
// light durations input mode
cli();
// '*' is probably still pressed, though may not be
WaitForKeyUp();
ShortDelay();
for (unsigned curState = 0; curState < NSTATES; curState++)
{
// show current state on indicator
PORTB = curState;
int newDuration = 0;
for (unsigned i = 0; i < 2; i++)
{
char key = WaitAndReadKey();
// ignore non-digit keys
if (key >= 0 && key < 10)
newDuration = newDuration * 10 + key;
ShortDelay();
WaitForKeyUp();
ShortDelay();
}
stateDurations[curState] = newDuration;
}
// update durations in eeprom
// for some reason src is first in WinAVR, ignore warning!
eeprom_write_block(stateDurations, stateDurations0, sizeof(stateDurations));
inputMode = 0;
// start from state 0
state = 0;
secondsLeft = stateDurations[0];
sei();
}
// just for the sake of it
return 0;
}
0
IT_Exp
Эксперт
34794 / 4073 / 2104
Регистрация: 17.06.2006
Сообщений: 32,602
Блог
20.04.2015, 15:26
Ответы с готовыми решениями:

Исправление ошибок в коде
Выводит ошибки C4018 и еще пару ошибок компилятора #include &lt;iostream&gt; #include &lt;iomanip&gt; #include...

Исправление ошибок в коде
Нужно исправить все ошибки в этом коде. Заранее спасибо.

Исправление ошибок в коде
При компиляции выдает ошибку expected unqualified-id before 'while' #include &lt;iostream&gt; #include &lt;cmath&gt; double x, ep, s; int z,...

19
Котовчанин
942 / 482 / 200
Регистрация: 16.02.2010
Сообщений: 3,338
Записей в блоге: 35
20.04.2015, 15:28
Kolek000, ошибки в студию.
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 15:36  [ТС]
Компилятор: Default compiler
Выполнение g++.exe...
g++.exe "C:\Users\Дом\Desktop\Безымянный1.cp p" -o "C:\Users\Дом\Desktop\Безымянный1.ex e" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Users\Дом\Desktop\Безымянный1.cpp:1:2 0: avr/io.h: No such file or directory

C:\Users\Дом\Desktop\Безымянный1.cpp:2:2 7: avr/interrupt.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:3:2 4: avr/eeprom.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:4:2 3: avr/sleep.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:5:2 4: util/delay.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:13: error: expected init-declarator before "EEMEM"
C:\Users\Дом\Desktop\Безымянный1.cpp:13: error: expected `,' or `;' before "EEMEM"

C:\Users\Дом\Desktop\Безымянный1.cpp: In function `void ShortDelay()':
C:\Users\Дом\Desktop\Безымянный1.cpp:28: error: `_delay_ms' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:28: error: (Each undeclared identifier is reported only once for each function it appears in.)

C:\Users\Дом\Desktop\Безымянный1.cpp: In function `char ReadKey()':
C:\Users\Дом\Desktop\Безымянный1.cpp:37: error: `PORTA' undeclared (first use this function)

C:\Users\Дом\Desktop\Безымянный1.cpp:39: error: `PINC' undeclared (first use this function)

C:\Users\Дом\Desktop\Безымянный1.cpp: At global scope:
C:\Users\Дом\Desktop\Безымянный1.cpp:59: error: expected constructor, destructor, or type conversion before '(' token
C:\Users\Дом\Desktop\Безымянный1.cpp:59: error: expected `,' or `;' before '(' token

C:\Users\Дом\Desktop\Безымянный1.cpp: In function `int main()':
C:\Users\Дом\Desktop\Безымянный1.cpp:78: error: `ACSR' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:78: error: `ACD' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:80: error: `stateDurations0' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:80: error: `eeprom_read_block' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:83: error: `DDRD' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:85: error: `DDRB' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:87: error: `DDRA' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:89: error: `PORTC' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:90: error: `DDRC' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:94: error: `OCR1A' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:94: error: `F_CPU' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `TCCR1B' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `WGM12' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `CS12' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `CS11' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `CS10' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:96: error: `TIMSK1' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:96: error: `OCIE1A' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:97: error: `sei' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:103 : error: `SLEEP_MODE_IDLE' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:103 : error: `set_sleep_mode' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:104 : error: `sleep_mode' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:108 : error: `cli' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:115 : error: `PORTB' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:131 : error: `eeprom_write_block' undeclared (first use this function)

Выполнение завершено
0
Котовчанин
942 / 482 / 200
Регистрация: 16.02.2010
Сообщений: 3,338
Записей в блоге: 35
20.04.2015, 15:37
Kolek000, дк... Батенька, тут же все ошибки на ладоне просто. С чем проблемы? Как минимум - у Вас целая масса непонятных компилятору "переменных".
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 15:44  [ТС]
не могу скомпилировать данный код

Добавлено через 6 минут
сможете помочь в исправлении кода?
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 15:50
Цитата Сообщение от Kolek000 Посмотреть сообщение
C:\Users\Дом\Desktop\Безымянный1.cpp:1:2 0: avr/io.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:2:2 7: avr/interrupt.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:3:2 4: avr/eeprom.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:4:2 3: avr/sleep.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:5:2 4: util/delay.h: No such file or directory
Пропиши пути до папок avr и util в настройках проекта.
0
Котовчанин
942 / 482 / 200
Регистрация: 16.02.2010
Сообщений: 3,338
Записей в блоге: 35
20.04.2015, 15:51
Kolek000, а чем я помогу? Вы наставили кучу непонятных переменных. Автор кода знает, что это и зачем. Если Вы не автор(скорее всего), советую найти его и спросить.
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 15:53
C++
1
2
// stateDurations0 in eeprom, read on reset, written on change by user
const unsigned stateDurations0[NSTATES] /*EEMEM*/ = {3, 1, 3, 1}; <-- убери этот EEMEM
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 15:53  [ТС]
попробуйте пожалуйста исправить , рассчитываю на вашу помощь
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 15:58
Kolek000, указанные исправления сделал?
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 16:01  [ТС]
сделал
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 16:02
Что изменилось?
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 16:13  [ТС]
Число ошибок сократилось

Компилятор: Default compiler
Выполнение g++.exe...
g++.exe "C:\Users\Дом\Desktop\Безымянный1.cp p" -o "C:\Users\Дом\Desktop\Безымянный1.ex e" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Users\Дом\Desktop\Безымянный1.cpp:1:2 0: avr/io.h: No such file or directory

C:\Users\Дом\Desktop\Безымянный1.cpp:2:2 7: avr/interrupt.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:3:2 4: avr/eeprom.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:4:2 3: avr/sleep.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp:5:2 4: util/delay.h: No such file or directory
C:\Users\Дом\Desktop\Безымянный1.cpp: In function `void ShortDelay()':
C:\Users\Дом\Desktop\Безымянный1.cpp:28: error: `_delay_ms' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:28: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Users\Дом\Desktop\Безымянный1.cpp: In function `char ReadKey()':
C:\Users\Дом\Desktop\Безымянный1.cpp:37: error: `PORTA' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:39: error: `PINC' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp: At global scope:
C:\Users\Дом\Desktop\Безымянный1.cpp:59: error: expected constructor, destructor, or type conversion before '(' token

C:\Users\Дом\Desktop\Безымянный1.cpp:59: error: expected `,' or `;' before '(' token
C:\Users\Дом\Desktop\Безымянный1.cpp: In function `int main()':
C:\Users\Дом\Desktop\Безымянный1.cpp:78: error: `ACSR' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:78: error: `ACD' undeclared (first use this function)

C:\Users\Дом\Desktop\Безымянный1.cpp:80: error: `eeprom_read_block' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:83: error: `DDRD' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:85: error: `DDRB' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:87: error: `DDRA' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:89: error: `PORTC' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:90: error: `DDRC' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:94: error: `OCR1A' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:94: error: `F_CPU' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `TCCR1B' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `WGM12' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `CS12' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `CS11' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:95: error: `CS10' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:96: error: `TIMSK1' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:96: error: `OCIE1A' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:97: error: `sei' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:103 : error: `SLEEP_MODE_IDLE' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:103 : error: `set_sleep_mode' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:104 : error: `sleep_mode' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:108 : error: `cli' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:115 : error: `PORTB' undeclared (first use this function)
C:\Users\Дом\Desktop\Безымянный1.cpp:131 : error: `eeprom_write_block' undeclared (first use this function)

Выполнение завершено

Добавлено через 1 минуту
куда прописать пути?

Добавлено через 3 минуты
у меня этих папок нет (

Добавлено через 3 минуты
можно ли их заменить на что нибудь другое ?
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 16:13
Цитата Сообщение от Kolek000 Посмотреть сообщение
куда прописать пути?
В той версии DevC++, которая у меня: Параметры проекта -> Файлы/каталоги -> Файлы включения.
Цитата Сообщение от Kolek000 Посмотреть сообщение
у меня этих папок нет (
Ну так а чего ты тогда хочешь? Надо, чтобы они были, вместе со всеми файлами, которые в них должны быть.
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 16:19  [ТС]
где можно взять эти библиотеки?
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 16:24
Kolek000, не имею ни малейшего понятия. Судя по названию (avr) это что-то для работы с AVR микроконтроллерами. Тут на форуме есть раздел, попробуй там спросить.
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 16:26  [ТС]
я сейчас скачаю эти библиотеки и вам напишу
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 16:28
Жду.
0
0 / 0 / 0
Регистрация: 25.03.2013
Сообщений: 112
20.04.2015, 16:49  [ТС]
я закинул эти библиотеки и компилятор теперь указывает на ошибку _delay_ms(15); . Я так понимаю , что я не правильно закинул библиотеки и компилятор не понимает что такое _delay_ms(15); ?!)

Компилятор: Default compiler
Выполнение g++.exe...
g++.exe "C:\Users\Дом\Desktop\main.cpp" -o "C:\Users\Дом\Desktop\main.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Users\Дом\Desktop\main.cpp:1:20: avr/io.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:2:27: avr/interrupt.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:3:24: avr/eeprom.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:4:23: avr/sleep.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:5:24: util/delay.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp: In function `void ShortDelay()':

C:\Users\Дом\Desktop\main.cpp:28: error: `_delay_ms' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:28: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Users\Дом\Desktop\main.cpp: In function `char ReadKey()':
C:\Users\Дом\Desktop\main.cpp:37: error: `PORTA' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:39: error: `PINC' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp: At global scope:
C:\Users\Дом\Desktop\main.cpp:59: error: expected constructor, destructor, or type conversion before '(' token
C:\Users\Дом\Desktop\main.cpp:59: error: expected `,' or `;' before '(' token
C:\Users\Дом\Desktop\main.cpp: In function `int main()':
C:\Users\Дом\Desktop\main.cpp:78: error: `ACSR' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:78: error: `ACD' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:80: error: `eeprom_read_block' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:83: error: `DDRD' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:85: error: `DDRB' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:87: error: `DDRA' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:89: error: `PORTC' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:90: error: `DDRC' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:94: error: `OCR1A' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:94: error: `F_CPU' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:95: error: `TCCR1B' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:95: error: `WGM12' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:95: error: `CS12' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:95: error: `CS11' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:95: error: `CS10' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:96: error: `TIMSK1' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:96: error: `OCIE1A' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:97: error: `sei' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:103: error: `SLEEP_MODE_IDLE' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:103: error: `set_sleep_mode' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:104: error: `sleep_mode' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:108: error: `cli' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:115: error: `PORTB' undeclared (first use this function)
C:\Users\Дом\Desktop\main.cpp:131: error: `eeprom_write_block' undeclared (first use this function)

Выполнение завершено
0
2393 / 1922 / 763
Регистрация: 27.07.2012
Сообщений: 5,562
20.04.2015, 16:53
Цитата Сообщение от Kolek000 Посмотреть сообщение
C:\Users\Дом\Desktop\main.cpp:1:20: avr/io.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:2:27: avr/interrupt.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:3:24: avr/eeprom.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:4:23: avr/sleep.h: No such file or directory
C:\Users\Дом\Desktop\main.cpp:5:24: util/delay.h: No such file or directory
Ну ты же видишь, что он не находит файлы. Значит ты либо неправильно прописал пути к библиотекам, либо этих файлов там нет.

Добавлено через 1 минуту
Если всё верно прописал, а он всё равно не находит, попробуй полный путь указать в #include
C++
1
#include "/*полный путь до файла*/"
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
BasicMan
Эксперт
29316 / 5623 / 2384
Регистрация: 17.02.2009
Сообщений: 30,364
Блог
20.04.2015, 16:53
Помогаю со студенческими работами здесь

Исправление ошибок в коде
Ребят, помогите пожалуйста, уже завтра экзамен, а я понятия не имею как исправить ошибки в данном коде(строки с ошибками помечены так (*))....

Исправление ошибок
Есть задание : Во введенной строке заменить все пробелы на запятые, а запятые на точки. Посчитать количество запятых во введенной строке....

Исправление ошибок
Дано 100 вещественных чисел. Определить, образуют ли они возрастающую последовательность. #include &quot;stdafx.h&quot; #include...

Исправление ошибок
Помогите разобраться, в чём моя ошибка. Не хочет компилировать. #include &lt;iostream&gt; #include &lt;string&gt; using namespace std; ...

исправление ошибок
//funkcijas1 #include &lt;iostream&gt; using namespace std; int main() { int i, fact=1, n; cout &lt;&lt;&quot;Введите целое...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
20
Ответ Создать тему
Новые блоги и статьи
SDL3 для Web (WebAssembly): Реализация движения на Box2D v3 - трение и коллизии с повёрнутыми стенами
8Observer8 20.02.2026
Содержание блога Box2D позволяет легко создать главного героя, который не проходит сквозь стены и перемещается с заданным трением о препятствия, которые можно располагать под углом, как верхнее. . .
Конвертировать закладки radiotray-ng в m3u-плейлист
damix 19.02.2026
Это можно сделать скриптом для PowerShell. Использование . \СonvertRadiotrayToM3U. ps1 <path_to_bookmarks. json> Рядом с файлом bookmarks. json появится файл bookmarks. m3u с результатом. # Check if. . .
Семь CDC на одном интерфейсе: 5 U[S]ARTов, 1 CAN и 1 SSI
Eddy_Em 18.02.2026
Постепенно допиливаю свою "многоинтерфейсную плату". Выглядит вот так: https:/ / www. cyberforum. ru/ blog_attachment. php?attachmentid=11617&stc=1&d=1771445347 Основана на STM32F303RBT6. На борту пять. . .
Камера Toupcam IUA500KMA
Eddy_Em 12.02.2026
Т. к. у всяких "хикроботов" слишком уж мелкий пиксель, для подсмотра в ESPriF они вообще плохо годятся: уже 14 величину можно рассмотреть еле-еле лишь на экспозициях под 3 секунды (а то и больше),. . .
И ясному Солнцу
zbw 12.02.2026
И ясному Солнцу, и светлой Луне. В мире покоя нет и люди не могут жить в тишине. А жить им немного лет.
«Знание-Сила»
zbw 12.02.2026
«Знание-Сила» «Время-Деньги» «Деньги -Пуля»
SDL3 для Web (WebAssembly): Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 12.02.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами и вызывать обработчики событий столкновения. . . .
SDL3 для Web (WebAssembly): Загрузка PNG с прозрачным фоном с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 11.02.2026
Содержание блога Библиотека SDL3 содержит встроенные инструменты для базовой работы с изображениями - без использования библиотеки SDL3_image. Пошагово создадим проект для загрузки изображения. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru