Stray 302 in program arduino

I’m using Code::Blocks on Ubuntu 10.10. I have connected a Mac keyboard and set the keyboard settings to "Swiss German Mac". Now whenever I write an equals sign, followed by a space (something like w in program.

I know this error means that there is a non standard character in the text file.

When I delete the space character the program compiles just fine. So that means Code::Blocks adds some sort of special character. But I can’t see why this happens. Anybody have an idea.

What character does ‘302’ stand for?

[UPDATE] I got a little further investigating the problem. I get this stray when I use the combo shift+space. Now that I know it doesn’t happen that often anymore. But it’s still rather annoying especially when writing code. Anybody know if there is a way to turn off this combo in X11?

[SOLVED] Thanks to Useless’s answer, I was able to solve the "issue". It’s more of a feature actually. Shift+space created a spacenolinebreak by default. So by changing the xmodmap with

this behavior was overridden and everything works fine now.

For some weird reason, the following code doesn’t compile. I get a "stray ‘302’ in program" error around volatile unsigned int encoderPos = 0; , and I have no idea what the issue is. I’ve been trying to figure this out for over 40min, and nothing works. It doesn’t make any sense 😭

2 Answers 2

0302 is 0xc2. Somewhere in your source you have one or more non-breaking spaces (0xa0) encoded in UTF-8 (0xc2 0xa0). Use od or a similar tool to find them, and then replace them with normal spaces. Since you have non-ASCII Latin-1 characters in your source, those characters are encoded as two bytes with the first being 0xc2 or 0xc3. Remove all non-ASCII characters before proceeding.

Читайте также:  Pci ven 1002 dev 6900 cc 0380

One cause of the /(302) error is copy and paste code from a word processor. You have ASCII codes copied that add spaces, etc to your code. Go through each identified line and remove any extra spaces at the beginning and end of any identified line. Then, (Arduino IDE) go to TOOLS, Auto Format. At least, this cleared up the problem for me.

Not the answer you’re looking for? Browse other questions tagged programming arduino-ide sketch compilation-errors or ask your own question.

Linked

Related

Hot Network Questions

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

site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0 with attribution required. rev 2020.1.17.35809

Я взял sqlconnect из примера C ++ отсюда: sql connect из c ++ . Я хочу вставить данные в таблицу MySQL из C ++. Я просто пытаюсь запустить первый пример, чтобы избавиться от него. Пожалуйста, предложите, что я должен заботиться?

Все хорошо, почему это дает ошибку:

Я видел подобную нить на SO, но все же это не решается!

Решение

Где-то в строках 65 и 69 у вас есть нечетные символы. Они могут быть невидимыми символами, поэтому в общем случае, когда вы сталкиваетесь с этой ошибкой, просто удалите всю строку и введите ее снова.

В этом случае у вас есть несколько странных символов здесь:

Вы, вероятно, должны удалить это, и то же самое несколько строк ниже.

Другие решения

Какая «похожая тема»? Был один недавно, и проблема была описана как вызванная копирования вставки код с сайта, который переводил прямые кавычки и черточки в фигурные кавычки и черточки. Они, в свою очередь, транслитерировались с использованием UTF-8 и действительно:

Читайте также:  Qcyber драйвер для клавиатуры

302 (восьмеричное) — это «В» — 0xC2
273 — это «» »- 0xBB

Это дает полный действительный код UTF8 «0xC2BB», который происходит снова быть персонажем «» ». Теперь посмотрите на строку 65 в вашем коде — так оно и есть, как сказано в сообщении об ошибке.

Rate this post

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *