Error expected unqualified id before else

Ошибка "expected unqualified-id before 'if'" Arduino Решение и ответ на вопрос 2216532

1 / 1 / 0

Регистрация: 25.03.2018

Сообщений: 2

26.03.2018, 23:30

 [ТС]

4

Спасибо, буду изучать! Я не претендую на гуру, глуп в програмировании, хотел чтобы носом тыкнули) если у кого время будет, укажите на ошибку, легче будет учить основы!!! За ранее спасибо!)

Добавлено через 23 часа 11 минут
по изучал вопрос, с переменной float конечно напортачил… блин, но ошибку компиляции —

expected unqualified-id before ‘if’
expected unqualified-id before ‘else’
expected declaration before ‘}’ token

ни как не могу понять! Походу тупо синтаксис не верный! Прошу указать, или хотябы навести на информацию!!! вот скетч :

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
#include <DHT.h> // библиотека датчика
#include <LCD5110_Basic.h> // подключаем библиотеку
#define DHTPIN 2
#define Relay 12
LCD5110 myGLCD(7,6,5,4,3); // объявляем номера пинов LCD
DHT dht(DHTPIN, DHT11);
 
extern uint8_t SmallFont[]; // малый шрифт (из библиотеки)
extern uint8_t MediumNumbers[]; // средний шрифт для цифр (из библиотеки)
 
 
void setup() {
  dht. begin();
  pinMode (Relay, OUTPUT);
  myGLCD.InitLCD(); // инициализация LCD дисплея
}
 
void loop(){
 
  delay (1000);
  int h = dht.readHumidity();
  int t = dht.readTemperature(); 
  myGLCD.clrScr(); // очистка экрана
  myGLCD.setFont(SmallFont); // задаём размер шрифта
  myGLCD.printNumI( t, LEFT, 0);// выводим на строке 0, равнение по левому краю  
  myGLCD.print("c", CENTER, 0);// знак цельсии
  myGLCD.printNumI( h, LEFT, 16); // выводим в строке 16 
  myGLCD.print("%", CENTER, 16); //знак %
  delay (1000); // задержка 1 сек
}
if (h > 40) //Указываем условие, если переменная "h" (влажность) больше 40% 
{ 
digitalWrite (Relay, LOW); //то включаем наше реле, которое приводит в действие вентилятор 
} 
else //иначе 
{ 
digitalWrite (Relay, HIGH); //Реле будет выключено, вентилятор не работает 
} 
 
}

Добавлено через 14 минут
ВСЕ ошибку решил, убрал фигурную скобку перед функцией «if» !! Но блин реле не срабатывает(

Добавлено через 7 минут
ВСЕ ЗАРАБОТАЛО!! перезагрузил и ок))) ВСЕМ БОЛЬШОЕ СПАСИБО ЗА НАВОДКИ!))



1



  • Forum
  • Beginners
  • Expected unqualified-id

Expected unqualified-id

Hi, I’m having some issues with my code and I am getting some odd errors.

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
#include<iostream>
#include<cmath>
using namespace std;

int main() {

cout << "Enter three numbers: " << endl;
char cond1,cond2,cond3;
int num1, num2, num3;
cin >> num1 >> num2 >> num3;

if (num1>num2);{
cond1 = 't';}
else{
cond1 = 'f'
}
if (num1>num3){
cond2 = 't'}
else{
cond2 = 'f'}
if (num2>num3){
cond3 = 't'}
else{
 cond3 = 'f'}


if (cond1 == 't' && cond2 == 't'){
cout << num1 << " is the maximum" << endl;
else if (cond1 == 't' && cond2 == 'f'){
cout << num3 << " is the maximum" << endl;}
else if (cond1 == 'f' && cond3 == 't'){
cout << num2 << " is the maximum" << endl;}
}

if (cond1 == 'f' && cond2 == 'f') {
cout << num1 << " is the minimum" << endl;
}
else if (cond1 == 't' && cond3 == 'f'){
cout << num2 << " is the minimum" << endl;}
else if (cond2 == 't' && cond3 == 't');{
cout << num3 << " is the minimum" << endl;}
}
return 0;

Please excuse the sloppy formatting.

Here are the errors I am receiving when I try to run the code:

1
2
3
4
5
6
7
8
9
Lab3P2.cpp: In function 'int main()':
Lab3P2.cpp:15: error: expected `}' before 'else'
Lab3P2.cpp: At global scope:
Lab3P2.cpp:15: error: expected unqualified-id before 'else'
Lab3P2.cpp:18: error: expected unqualified-id before 'if'
Lab3P2.cpp:20: error: expected unqualified-id before 'else'
Lab3P2.cpp:22: error: expected unqualified-id before 'if'
Lab3P2.cpp:24: error: expected unqualified-id before 'else'
Lab3P2.cpp:28: error: expected unqualified-id before 'if' 

I have no idea what they mean by «expected unqualified-id before», and every time I add the } before «else» in line 15, I just get more errors.

Any help would be greatly appreciated.

Last edited on

Remove the ; from line 13.

You have a semicolon on line 13 that shouldn’t be there.

16, 19, 22, 25 all require semicolons (before the brace but after the letter):

cond2 = 't' ; /*<--*/ }

Thanks for the help so far. I did what you guys said, and now I’ve gotten these errors:

1
2
3
4
5
6
7
8
Lab3P2.cpp: In function 'int main()':
Lab3P2.cpp:29: error: expected `}' before 'else'
Lab3P2.cpp: At global scope:
Lab3P2.cpp:35: error: expected unqualified-id before 'if'
Lab3P2.cpp:38: error: expected unqualified-id before 'else'
Lab3P2.cpp:40: error: expected unqualified-id before 'else'
Lab3P2.cpp:40: error: expected unqualified-id before '{' token
Lab3P2.cpp:42: error: expected declaration before '}' token 

So I get a few more of the expected unqualified-id errors, but in different lines now, and I’m still not entirely sure what this is supposed to mean.

Here’s the updated code, if it helps:

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

#include<iostream>
#include<cmath>
using namespace std;

int main() {

cout << "Enter three numbers: " << endl;
char cond1,cond2,cond3;
int num1, num2, num3;
cin >> num1 >> num2 >> num3;

if (num1>num2){
cond1 = 't';}
else{
cond1 = 'f';
}
if (num1>num3){
cond2 = 't';}
else{
cond2 = 'f';}
if (num2>num3){
cond3 = 't';}
else{
 cond3 = 'f';}


if (cond1 == 't' && cond2 == 't'){
cout << num1 << " is the maximum" << endl;
else if (cond1 == 't' && cond2 == 'f'){
cout << num3 << " is the maximum" << endl;}
else if (cond1 == 'f' && cond3 == 't'){
cout << num2 << " is the maximum" << endl;}
}

if (cond1 == 'f' && cond2 == 'f') {
cout << num1 << " is the minimum" << endl;
}
else if (cond1 == 't' && cond3 == 'f'){
cout << num2 << " is the minimum" << endl;}
else if (cond2 == 't' && cond3 == 't');{
cout << num3 << " is the minimum" << endl;}
}
return 0;

Last edited on

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
#include<iostream>
#include<cmath>
using namespace std;

int main() {

cout << "Enter three numbers: " << endl;
char cond1,cond2,cond3;
int num1, num2, num3;
cin >> num1 >> num2 >> num3;

if (num1>num2){
cond1 = 't';
}
else{
cond1 = 'f';
}
if (num1>num3){
cond2 = 't';
}
else{
cond2 = 'f';
}
if (num2>num3){
cond3 = 't';
}
else{
 cond3 = 'f';
}


if (cond1 == 't' && cond2 == 't'){
cout << num1 << " is the maximum" << endl;
}
else if (cond1 == 't' && cond2 == 'f'){
cout << num3 << " is the maximum" << endl;
}
else if (cond1 == 'f' && cond3 == 't'){
cout << num2 << " is the maximum" << endl;
}

if (cond1 == 'f' && cond2 == 'f') {
cout << num1 << " is the minimum" << endl;
}
else if (cond1 == 't' && cond3 == 'f'){
cout << num2 << " is the minimum" << endl;
}
else if (cond2 == 't' && cond3 == 't');{
cout << num3 << " is the minimum" << endl;
}
return 0;
}

Missing ‘}’ at the end and a few other edits done.

Last edited on

You really need to work on indenting your code:

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
#include<iostream>
#include<cmath>
using namespace std;

int main()
{

	cout << "Enter three numbers: " << endl;
	char cond1,cond2,cond3;
	int num1, num2, num3;
	cin >> num1 >> num2 >> num3;

	if (num1>num2)
	{
		cond1 = 't';
	}
	else
	{
		cond1 = 'f';
	}
	if (num1>num3)
	{
		cond2 = 't';
	}
	else
	{
		cond2 = 'f';
	}
	if (num2>num3)
	{
		cond3 = 't';
	}
	else
	{
		cond3 = 'f';
	}


	if (cond1 == 't' && cond2 == 't')
	{
		cout << num1 << " is the maximum" << endl;
	}// you were missing this
	else if (cond1 == 't' && cond2 == 'f')
	{
		cout << num3 << " is the maximum" << endl;
	}
	else if (cond1 == 'f' && cond3 == 't')
	{
		cout << num2 << " is the maximum" << endl;
	}

	if (cond1 == 'f' && cond2 == 'f')
	{
		cout << num1 << " is the minimum" << endl;
	}
	else if (cond1 == 't' && cond3 == 'f')
	{
		cout << num2 << " is the minimum" << endl;
	}
	else if (cond2 == 't' && cond3 == 't') //; // this doesn't belong here
	{
		cout << num3 << " is the minimum" << endl;
	}
//} // this doesn't go here	
	return 0;
} // it goes here 

Thanks CaptainBlastXD, works with your edits. Greatly appreciate all the help guys.

Topic archived. No new replies allowed.

#include <SoftwareSerial.h>

SoftwareSerial wifiSerial(2, 3);

#define RED 11
#define GRN 12
#define BLU 13

void setup()
{
  pinMode(RED, OUTPUT);
  pinMode(GRN, OUTPUT);
  pinMode(BLU, OUTPUT);

  Serial.begin(115200);
  while (!Serial) {
    ;
  }
}

void loop() {
  digitalWrite(RED, LOW);
  digitalWrite(GRN, LOW);
  digitalWrite(BLU, LOW);
}
if (Serial.available() > 0) {
  String message = readSerialMessage();
}

if (find(message, "debugEsp8266:")) {   //Вот здесь выдает ошибку
  String result = sendToWifi(message.substring(13, message.length()), responseTime, DEBUG);
  if (find(result, "OK")) {
    sendData("nOK");
    else
      sendData("nEr");
  }
  if (wifiSerial.available() > 0) {

    String message = readWifiSerialMessage();

    if (find(message, "esp8266:")) {
      String result = sendToWifi(message.substring(8, message.length()), responseTime, DEBUG);
      if (find(result, "OK"))
        sendData("n" + result);
      else
        sendData("nErrRead");               //At command ERROR CODE for Failed Executing statement
    } else if (find(message, "Red")) { //receives HELLO from wifi
      sendData("\nOh, red!")
      digitalWrite(RED, HIGH)
      delay(5000);    //arduino says HI
    } else if (find(message, "Green")) {
      //turn on built in LED:
      sendData("\nOh, green!")
      digitalWrite(GREEN, HIGH)
      delay(5000);
    } else if (find(message, "Blue")) {
      //turn off built in LED:
      sendData("\nOn, blue!")
      digitalWrite(BLUE, HIGH)
      delay(5000);
    }
    else {
      sendData("nErrRead");                 //Command ERROR CODE for UNABLE TO READ
    }
    delay(responseTime);
  }
}

Expected unqualified id errorThe expected unqualified id error shows up due to mistakes in the syntax. As there can be various situations for syntax errors, you’ll need to carefully check your code to correct them. Also, this post points toward some common mistakes that lead to the same error.

Go through this article to get an idea regarding the possible causes and gain access to the solutions to fix the given error.

Contents

  • Why Are You Getting the Expected Unqualified Id Error?
    • – Missing or Misplaced Semicolons
    • – Extra or Missing Curly Braces
    • – String Values Without Quotes
  • How To Fix the Error?
    • – Get Right With Semicolons
    • – Adjust the Curly Braces To Fix the Expected Unqualified Id Error
    • – Wrap the String Values inside Quotes
  • FAQ
    • – What Does a Qualified ID Mean?
    • – What Does the Error: Expected ‘)’ Before ‘;’ Token Inform?
    • – What Do You Mean By Token in C++?
  • Conclusion

Why Are You Getting the Expected Unqualified Id Error?

You are getting the expected unqualified-id error due to the erroneous syntax. Please have a look at the most common causes of the above error.

– Missing or Misplaced Semicolons

You might have placed a semicolon in your code where it wasn’t needed. Also, if your code misses a semicolon, then you’ll get the same error. For example, a semicolon in front of a class name or a return statement without a semicolon will throw the error.

This is the problematic code:

#include <iostream>
using namespace std;
class myClass;
{
private:
string Age;
public:
void setAge(int age1)
{
Age = age1;
}
string getAge()
{
return Age
}
}

Now, if your code contains extra curly braces or you’ve missed a curly bracket, then the stated error will show up.

The following code snippet contains an extra curly bracket:

#include <iostream>
using namespace std;
class myClass;
{
private:
string Age;
public:
void setAge(int age1)
{
Age = age1;
}
}
}

– String Values Without Quotes

Specifying the string values without quotes will throw the stated error.

Here is the code that supports the given statement:

void displayAge()
{
cout << Your age is << getWord() << endl;
}

How To Fix the Error?

You can fix the mentioned unqualified-id error by removing the errors in the syntax. Here are the quick solutions that’ll save your day.

– Get Right With Semicolons

Look for the usage of the semicolons in your code and see if there are any missing semicolons. Next, place the semicolons at their correct positions and remove the extra ones.

Here is the corrected version of the above code with perfectly-placed semicolons:

#include <iostream>
using namespace std;
class myClass
{
private:
string Age;
public:
void setAge(int age1)
{
Age = age1;
}
string getAge()
{
return Age;
}
}

– Adjust the Curly Braces To Fix the Expected Unqualified Id Error

You should match the opening and closing curly braces in your code to ensure the right quantity of brackets. The code should not have an extra or a missing curly bracket.

– Wrap the String Values inside Quotes

You should always place the string values inside quotes to avoid such errors.

This is the code that will work fine:

void displayAge()
{
court << “Your age is” << getWord() << endl;
}

FAQ

You can have a look at the following questions and answers to enhance your knowledge.

– What Does a Qualified ID Mean?

A qualified-id means a qualified identifier that further refers to a program element that is represented by a fully qualified name. The said program element can be a variable, interface, namespace, etc. Note that a fully qualified name is made up of an entire hierarchical path having the global namespace at the beginning.

– What Does the Error: Expected ‘)’ Before ‘;’ Token Inform?

The error: expected ‘)’ before ‘;’ token tells that there is a syntax error in your code. Here, it further elaborates that there is an unnecessary semi-colon before the closing round bracket “).” So, you might get the above error when you terminate the statements that don’t need to be ended by a semi-colon.

– What Do You Mean By Token in C++?

A token is the smallest but important component of a C++ program. The tokens include keywords, punctuators, identifiers, etc. For example, you missed a semi-colon in your code because you considered it something that isn’t very important. But the C++ compiler will instantly show up an error pointing towards the missing “;” token.

Conclusion

The unqualified id error asks for a careful inspection of the code to find out the mistakes. Here are a few tips that’ll help you in resolving the given error:

  • Ensure the correct placement of semicolons
  • Aim to have an even number of curly brackets
  • Don’t forget to place the text inside the quotes

How to fix expected unqualified idNever write the code in hurry, you’ll only end up making more mistakes, and getting such errors.

  • Author
  • Recent Posts

Position is Everything

Position Is Everything: Your Go-To Resource for Learn & Build: CSS,JavaScript,HTML,PHP,C++ and MYSQL.

Position is Everything

Содержание

  1. Arduino.ru
  2. Регистрация новых пользователей и создание новых тем теперь только на новом форуме https://forum.arduino.ru
  3. forum.arduino.ru
  4. Ошибка в коде
  5. Arduino.ru
  6. Регистрация новых пользователей и создание новых тем теперь только на новом форуме https://forum.arduino.ru
  7. forum.arduino.ru
  8. Ошибки в скетчи.
  9. error: expected unqualified-id before ‘else’
  10. 3 Answers 3
  11. Related
  12. Hot Network Questions
  13. Subscribe to RSS
  14. Compiling error «expected unqualified-id before string constant» #3
  15. Comments

Arduino.ru

Регистрация новых пользователей и создание новых тем теперь только на новом форуме https://forum.arduino.ru

forum.arduino.ru

Ошибка в коде

Пожалуйста, ткните носом где не правильно . И если не трудно поясните почему так .

код вставлен не по правилам форума

вставьте код по правилам, чтобы можно было указать на ошибку

вставьте код по правилам, чтобы можно было указать на ошибку

подскажите, как исправить. не вижу кнопки редактировать сообщение

подскажите, как исправить. не вижу кнопки редактировать сообщение

вставьте новым сообшением

char key = keypad.getKey();
> — ета скобка должна стоять вконце

У вас в лупе обрабатывается только одна строка

у него вообще ничего не обрабатывается в лупе, потому что код не компилируется.

rtyz — вам же уже подсказали — скобка из строки 22 должна быть в конце скетча

rtyz — вам же уже подсказали — скобка из строки 22 должна быть в конце скетча

люди просили вставил по правила. Верно, человек подсказал. Вечером буду пробовать.

rtyz — вам же уже подсказали — скобка из строки 22 должна быть в конце скетча

люди просили вставил по правила. Верно, человек подсказал. Вечером буду пробовать.

не взлетит, функции тоже надо описать )))

rtyz — вам же уже подсказали — скобка из строки 22 должна быть в конце скетча

люди просили вставил по правила. Верно, человек подсказал. Вечером буду пробовать.

не взлетит, функции тоже надо описать )))

Тут работает https://www.drive2.ru/l/473922223116124256/ просто не видно знаков и скобок

rtyz — вам же уже подсказали — скобка из строки 22 должна быть в конце скетча

люди просили вставил по правила. Верно, человек подсказал. Вечером буду пробовать.

не взлетит, функции тоже надо описать )))

может и работает только не эта программа

rtyz — вам же уже подсказали — скобка из строки 22 должна быть в конце скетча

люди просили вставил по правила. Верно, человек подсказал. Вечером буду пробовать.

Источник

Arduino.ru

Регистрация новых пользователей и создание новых тем теперь только на новом форуме https://forum.arduino.ru

forum.arduino.ru

Ошибки в скетчи.

Здравствуйте, у меня вот такой скетч:

При компиляции скетча вылетет такая ошибка:

Версия ардуины 1.6.0

Ну, как минимум, количество открывающих фигурных скобок (6 шт.) не соответсвует количеству закрывающих (7 шт., лишняя в строке 32). И два раза подряд else (строки 28, 34), перед каждым else должен быть свой if.

все ошибки он вам и написал, даже со ссылками на строки, только чаще всего ошибки не в них, просто затык происходит у компилятора именно на этом месте.

операторы иф, елсе сами надеюсь поправите, не хочу ковыряться с вашими проверками. используйте их правильно и будет работать. а вообще заведите себе шаманский бубен програмиста, он помогает 🙂 с его помощью входите в транс и проникайте внутрь программы. и все.

http://arduino.ru/Reference/Else приведенные пример 2 гумно — новичку быстрее запутаться, чем разобраться

операторы после иф и елсе возмите за правило писать в < >я обычно делаю отступы

Странно, скетч показан что вкружен, но ардуино и датчик не хотят работать.

У меня вот ещё один вопрос. на этом видио https://www.youtube.com/watch?v=GVXQKYpCsNw объясняется как устронить основную проблему этого датчик HC-SR04. Но я не могу понять куда он этот доп. код нужно вставить( Пожалуйста, могли бы вы мне помочь. Вот этот код, который на видео:

duration = pulseIn(echoPin, HIGH);

Serial.println(«Reload ultrasonic, fix bug SR04» );

const int Trig = 8;

операторы после иф и елсе возмите за правило писать в < >я обычно делаю отступы

Я конечно извеняюсь, но Вы используете плохой стиль оформления кода. Советовать его новичкам — категорически не стоит.

«Открывающую скобку часто оставляют на одной строке с заголовком (оператора, подпрограммы, структуры и т. п.), при этом она может оказаться сколь угодно далеко справа, но закрывающая скобка при этом обязана находиться в той же колонке, где начался заголовок.»

понятнее намного будет писать так

а если вложенный, то

так понятно, что и где закрывается, и помогает от того, что все компилится, а работает не так

Прссститте! А можно уточнить? Очень важный для меня момент — по 10 минут по утрам трачу: вот с какого конца яйцо-в-смятку нужно разбивать? Вроде с тупого положено? Я где-то читал, что учить новичков разбивать с острого конца — это путь в АДДДД! Это так?

Скажите, почему этот скетч не фурычит.

форматирование кода не по феншую

ребята помогите пожалуйста. вот код

при попытке компиляции выходят такие ошибки

kod:7: error: found ‘:’ in nested-name-specifier, expected ‘::’

kod:7: error: ‘http’ does not name a type

H:проекты_arduinoСЂРѕР±РѕС‚ тележкаинет СЂРѕР±РѕС‚2 вариантkodkod.ino: In function ‘void loop()’:

kod:31: error: ‘LedStep’ was not declared in this scope

kod:36: error: ‘LedStep’ was not declared in this scope

kod:41: error: ‘LedStep’ was not declared in this scope

exit status 1
found ‘:’ in nested-name-specifier, expected ‘::’

что это за ошибки? код рабочий так как делал по статье

Убери ссылку из 7 строки. Если копипастишь откуда-то код — будь внимательнее.

форматирование кода не по феншую

Дядя шутить изволит ,убери ссылку и объяви переменную

вот твоя 7 и 8 строка

Здравствуйте, у меня вот такой скетч:

При компиляции скетча вылетет такая ошибка:

Это всё я исправил, скетч в ардуину вгрузился, но сама она и датчик не работают.

Тоесть на выходах ничего нету.

После void loop() <

у вас не хватает этих трёх строчек:

digitalWrite(11, LOW);
delayMicroseconds(2);
digitalWrite(11, HIGH);

Люди добрые, сорри, если злой офф-топ, но. всё ж это краем-то со скетчем связано 🙂

Старые файлы проектов *.ino открываются пустыми (сейчас ide v. 1.6.5). Хотя я с тех пор их не менял. Да и если на размер их посмотреть — они разного размера. И от пустого файла проекта отличаются. Как из них код вытащить? Качать и ставить старые версии IDE? А может какой редактор хитрый есть (а то нотпад тоже пустоту показывает :(( )

Люди добрые, сорри, если злой офф-топ, но. всё ж это краем-то со скетчем связано 🙂

Старые файлы проектов *.ino открываются пустыми (сейчас ide v. 1.6.5). Хотя я с тех пор их не менял. Да и если на размер их посмотреть — они разного размера. И от пустого файла проекта отличаются. Как из них код вытащить? Качать и ставить старые версии IDE? А может какой редактор хитрый есть (а то нотпад тоже пустоту показывает :(( )

ну, да — что ты намутил с правами доступа, только тебе самому известно. или антивирус с дурной головы установил.

Та не, на права бы он ругался. И на другой машине тоже были бы «вопросы» от системы. А ИДЕ просто открывает файл. Но открывает — пустым. А размер в килобайтах есть. То есть там есть что-то. Но как его открыть. Вот я и подумал, может кто с такой же проблеммой сталкивался уже и решение нашел.

UPD: в просмотрщике Командера, в двоичном и шестнадцатиричном режимах показывает, что файлы забиты нолями :((( Печаль. Как так вышло. Нолями, и файлы разных размером. Мистика.

Та не, на права бы он ругался. И на другой машине тоже были бы «вопросы» от системы. А ИДЕ просто открывает файл. Но открывает — пустым. А размер в килобайтах есть. То есть там есть что-то. Но как его открыть. Вот я и подумал, может кто с такой же проблеммой сталкивался уже и решение нашел.

ясно же что что-то не даёт софту доступ к содержимому файла — тебе кажется, что файл пустой, т.к. запускается текстовый редактор, который ничего не читает.

*скопируй на флешку и открой на другом компе.

Ну пусть я нуб, ладно.

Может у тебя не нолями забитый файл откроется 🙁

Ну пусть я нуб, ладно.

Может у тебя не нолями забитый файл откроется 🙁

да нули — не знаю, как можно такое сотворить.

Вооот. вынипарериишь! просто сохранил в своё время проекты и оставил так до лучших времен. ХЗ, что это. Тот, что прислал — в мае прошлого года делался. Чудеса в IDE. :))

при чём здесь ИДЕ?

ребята не пойму прикола. вот код

нажимаю 1 раз компилить выходят вот эти ошибки-

C:Program Files (x86)Arduino_newlibrariescyberlibCyberLib.cpp:199:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

C:Program Files (x86)Arduino_newlibrariescyberlibCyberLib.cpp:200:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

C:Program Files (x86)Arduino_newlibrariescyberlibCyberLib.cpp: In function ‘uint8_t ReadEEPROM_Byte(uint8_t)’:

C:Program Files (x86)Arduino_newlibrariescyberlibCyberLib.cpp:209:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

C:Program Files (x86)Arduino_newlibrariescyberlibCyberLib.cpp: In function ‘uint32_t ReadEEPROM_Long(uint8_t)’:

C:Program Files (x86)Arduino_newlibrariescyberlibCyberLib.cpp:220:55: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

uint32_t ir_code = eeprom_read_byte((uint8_t*)addr+3);

C:Program Files (x86)Arduino_newlibrariescyberlibCyberLib.cpp:221:63: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

ir_code = (ir_code Войдите на сайт для отправки комментариев

Источник

error: expected unqualified-id before ‘else’

I have tried checking other answers already, but I still cannot find the answer. I am getting this error:

Here is the line of code:

Where line 192 is

I don’t know what to do. I have tried adding/removing «>» and I get 15+ errors when I change a single brace so I don’t think that is the problem.

3 Answers 3

From this part of code it looks like you have too many closing brackets, reformat your code and check again.

edit: or too little opening brackets, anyway as in 1st answer proper formatting will help you.

the second else statement of yours, doesn’t belong there. cut it out and enter it after else if(userInput==3) block.

I have fixed the issue. I had one too many brackets and I was missing a parenthesis. Thank you everybody for your help, I am still very new to coding and all the help is greatly appreciated. I am using Notepad++ as of now, and am trying to learn proper indentation before it becomes a bad habit. Again, thank you all. Detailed answer:

> else if (userInput == 3) The > wasn’t necessary, one too many

and was also missing a parenthesis in a further line of code, which accounted for 10+ errors. Thanks again!

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.1.14.43159

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Compiling error «expected unqualified-id before string constant» #3

I am not able to compile the project on a freshly installed Arduino 1.8.6 with all referenced libs.

  • Arduino 1.8.6
  • NeoPixelBus 2.3.4
  • NTPClient 3.1.0
  • ESPAsyncTCP 1.2.0
  • ESPAsyncWebServer 1.2.0
  • ESPAsyncWiFiManager 0.1.6
  • ESP8266 community board definition 1.6.22
  • Board type: wemos d1 mini
  • wemos usb driver installed
  • SPIFFS uploader installed and functional

WebPixelFrame:933:15: error: expected unqualified-id before string constant
static void _u0_putc(char c) <
^

WebPixelFrame:940:9: error: expected unqualified-id before string constant
void saveConfigCallback () <
^

WebPixelFrame:958:9: error: expected unqualified-id before string constant
void initSerial() <
^

WebPixelFrame:968:9: error: expected unqualified-id before string constant
void setup() <
^

WebPixelFrame:1092:9: error: expected unqualified-id before string constant
void loop() <
^

exit status 1
expected unqualified-id before string constant

The text was updated successfully, but these errors were encountered:

I moved this function up:
//Use the internal hardware buffer
static void _u0_putc(char c) <
while (((U0S >> USTXC) & 0x7F) == 0x7F);
U0F = c;
>
to right before:
class DisplayHandler: public AsyncWebHandler <

Then it seemed to compile, but I ran into problems with the ESPAsyncWiFiManager.cpp — it wasn’t compiling until I commented out
//WiFi.beginWPSConfig();
in startWPS

I need to go back to the ESPAsyncWifiManager and try to fix that. Did you build a pixel frame?

  • with the mentioned changes it will compile successfully
  • because I have a 16×16 LED (should be ws2812 but I think its a sk clone) grid, I changed the configuration in DisplayPixel.h
  • LED grid is connected to D4 (so Arduino Pin 2 / Physical Pin 17) [Wemos D1 mini PinDef] I was not sure about which pin configuration to use for the NeuPixelBus object (arduino or physical style) so I tried both (2 and 17)
  • same result: only 1 yellow followed by a few white LEDs are active
  • the initial WiFi AP was visible and I was able to configure the correct WiFi network
  • ESP reconnected to the given new WiFi network and I was able to connect via browser
  • at this point I encountered some other errors and I tried to evaluate the cause:
  1. Web UI -> piskel gallery -> completely empty so I tried to create a new one but got an error during save with a web message «unknown error» and a ESP crash with stacktrace on serial console and reboot

Fatal exception 9(LoadStoreAlignmentCause)
ctx: sys
[. ]
Soft WDT reset

Web UI ->file editor -> Web UI is loading but on serial instant ESP crash with stacktrace and ESP reboot -> because Web UI is still trying to async load data this ends in an ESP crashing loop until I close the file editor UI

Web UI -> display clock -> shows message «clock started» but no reaction on LEDs

Web UI -> show GIFs -> shows message «starting gif loop» and serial is clearly in the gif loop because of «gif finished» messages but no reaction on LEDs

Web UI -> Text with color -> shows message «Setting scroll to: Hello» but no reaction on LEDs

Источник

Понравилась статья? Поделить с друзьями:
  • Error expected to return a value at the end of arrow function consistent return
  • Error expected string or bytes like object
  • Error expected specifier qualifier list before static
  • Error expected property shorthand object shorthand
  • Error expected primary expression before unsigned