Error stray 253 in program

Ошибка в ходе компиляции /home/openandfreealex/avr/main.c: In function ‘main’: /home/openandfreealex/avr/main.c:9:1: error: stray ‘302’ in program /home/openandfreealex/avr/main.c:9:1: error: stray ‘253’ in program /home/openandfreealex/avr/main.c:9:14: error: expected ‘)’ before numeric constant код: #include #include void init(void); int main(void) { init(); // Настройка переферии PORTE |= (1«2); while(1) { PORTA = 0b10101010; _delay_ms(100); _delay_ms(100); PORTA = 0b01010101; _delay_ms(100); _delay_ms(100); } } void init(void) { /* Конфигурирование портов (1-выход, 0-вход) */ DDRE = 0xFF; // PORTE - выход PORTE = 0x00; DDRA = 0xFF; // PORTA - выход PORTA = 0x00; } Пользователь решил продолжить мысль 25 Февраля 2012, 00:58:41: Можно закрывать, нашел.
  • Печать

Страницы: [1]   Вниз

Тема: Ошибка в ходе компиляции  (Прочитано 8893 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
OPENANDFREEALEX

Ошибка в ходе компиляции

/home/openandfreealex/avr/main.c: In function ‘main’:
/home/openandfreealex/avr/main.c:9:1: error: stray ‘302’ in program
/home/openandfreealex/avr/main.c:9:1: error: stray ‘253’ in program
/home/openandfreealex/avr/main.c:9:14: error: expected ‘)’ before numeric constant

код:

#include <avr/io.h>
#include <util/delay.h>

void init(void);

int main(void)
{
init(); // Настройка переферии
PORTE |= (1«2);
while(1)
{
PORTA = 0b10101010;
_delay_ms(100);
_delay_ms(100);
PORTA = 0b01010101;
_delay_ms(100);
_delay_ms(100);
}
}

void init(void)
{
/* Конфигурирование портов (1-выход, 0-вход) */
DDRE = 0xFF; // PORTE — выход
PORTE = 0x00;
DDRA = 0xFF; // PORTA — выход
PORTA = 0x00;
}


Пользователь решил продолжить мысль 25 Февраля 2012, 00:58:41:


Можно закрывать, нашел.

« Последнее редактирование: 25 Февраля 2012, 00:58:41 от OPENANDFREEALEX »


Оффлайн
НеФормат

НУ давай решение в студию


Оффлайн
Olej

НУ давай решение в студию

обычно такие сообщения:

/home/openandfreealex/avr/main.c:9:1: error: stray ‘302’ in program
/home/openandfreealex/avr/main.c:9:1: error: stray ‘253’ in program
лезут когда в С-коде недопустимые символы (байты текста кода) — это характерные и очень противные ошибки ;), такое часто бывает когда не закрытые литерали встречаются с русскими (UNICODE) буквами…

в данном случае это почти наверняка:

PORTE |= (1«2);
вместо 2-х знаков LT (<) случился какой-то странный знак кавычки.

P.S. это я написал, чтоб, кому случится, сразу знали в чём искать … «stray ‘253’» ;)


  • Печать

Страницы: [1]   Вверх

Содержание

  1. unixforum.org
  2. ошибки коплиляции программ Qt4, stray
  3. ошибки коплиляции программ Qt4, stray
  4. unixforum.org
  5. Решено: error: stray ‘4’ in program (не компилятся проги)
  6. Решено: error: stray ‘4’ in program
  7. mirsovetov.net
  8. Андрощук Александр, ИТ решения, советы, заметки…
  9. stray # in program
  10. Arduino.ru
  11. Регистрация новых пользователей и создание новых тем теперь только на новом форуме https://forum.arduino.ru
  12. forum.arduino.ru
  13. Ошибка 40: error: stray ‘’ in program
  14. Stray error in с program files

unixforum.org

Форум для пользователей UNIX-подобных систем

  • Темы без ответов
  • Активные темы
  • Поиск
  • Статус форума

ошибки коплиляции программ Qt4, stray

ошибки коплиляции программ Qt4, stray

Сообщение chups » 28.05.2008 17:17

всем привет. уважаемые форумчане подскажите в чем проблемма: пишу не очень сложную программку, до поры до времени она собиралась, а потом начались появляться непонятные мне ошибки компиляции:

/from PCLinuxOS/Data Base/current work/temp_tableview> make make: Warning: File `ui_dbFile.h’ has modification time 2,2e+04 s in the future g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include/QtSql -I/usr/include/QtSql -I/usr/include -I. -I. -I. -o table.o table.cpp table.cpp:10: error: stray ‘321’ in program table.cpp:10: error: stray ‘201’ in program table.cpp:13: error: stray ‘321’ in program table.cpp:13: error: stray ‘201’ in program table.cpp:15: error: stray ‘321’ in program table.cpp:15: error: stray ‘201’ in program make: *** [table.o] Ошибка 1

а вот здесь у меня вообще произошла ломка понятий :

/from PCLinuxOS/Data Base/current work/temp_tableview> make make: Warning: File `ui_dbFile.h’ has modification time 2,2e+04 s in the future g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_SQL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/default -I. -I/usr/include/QtCore -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtGui -I/usr/include/QtSql -I/usr/include/QtSql -I/usr/include -I. -I. -I. -o table.o table.cpp g++ -o temp_tableview main.o table.o workWithDb.o moc_workWithDb.o -L/usr/lib -lQtSql -L/usr/lib -lQtGui -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -lrt -ldl -lpthread make: предупреждение: Неправильный ход часов. Сборка может быть неполной.

В чем проблема? из-за чего возникают ошибки. код вроде правильный.
Qt4 изаю последний, пробовал собирать в 2 системах: opensuse и pclinuxos, результат одинаков

Источник

unixforum.org

Форум для пользователей UNIX-подобных систем

  • Темы без ответов
  • Активные темы
  • Поиск
  • Статус форума

Решено: error: stray ‘194’ in program (не компилятся проги)

Решено: error: stray ‘194’ in program

Сообщение LLIypynuk » 20.07.2007 07:31

Я новичек в программировании под Линух. Помогите.
Я хотел откомпилить очередную прогу с gcc, а она мне выдала FUCK! потом решил откомпилить свой HelloWorld,
но он тоже отказался компилиться и выкинул мне эт:
hello.c: In function ‘main’:
hello.c:5: error: stray ‘194’ in program
hello.c:5: error: stray ‘168’ in program
hello.c:5: error: ‘Hello’ undeclared (first use in this function)
hello.c:5: error: (Each undeclared identifier is reported only once
hello.c:5: error: for each function it appears in.)
hello.c:5: error: syntax error before ‘World!’
hello.c:5: error: stray ‘’ in program
hello.c:5: error: stray ‘194’ in program
hello.c:5: error: stray ‘168’ in program
hello.c:6:3: warning: no newline at end of file

Толи у мня руки из жопы , что ли чё.

====ну я надеюсь что это не первое! ======

Источник

mirsovetov.net

Андрощук Александр, ИТ решения, советы, заметки…

stray # in program

При компиляции проекта в Android IDE возникла ошибка

LampCore:20: error: stray ‘302’ in program

Код, который вызывал ошибку не был какой то особенный, была объявлена простенькая структура с полями:

В моем случае ошибка возникла из за того, что я случайно в названии структуры Config написал не латинский символ C. Самое интересное что с виду все кажется в порядке, а на самом деле это не так, и возникает ошибка «stray ‘320’ in program».

Так что решение — использовать только латинские символы (это не касается комментариев).

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

Скорее всего что следующие ошибки:

error stray 2 in program

error stray 200 in program

error stray 201 in program

error stray 213 in program

error stray 223 in program

error stray 226 in program

error stray 227 in program

error stray 240 in program

error stray 253 in program

error stray 273 in program

error stray 302 in program

error stray 320 in program

error stray 321 in program

error stray 340 in program

error stray 342 in program

error stray 357 in program

error stray 361 in program

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

Источник

Arduino.ru

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

forum.arduino.ru

Ошибка 40: error: stray ‘’ in program

Добрый день. Написал вот такую программульку:

// константы
const int dw = 12; // датчик уровня воды на 12 пин
const int dg1 = 11; // датчик влажности почвы на 11 пин
const int dg2 = 10; // датчик влажности почвы на 10 пин
const int dg3 = 9; // датчик влажности почвы на 9 пин
const int dg4 = 8; // датчик влажности почвы на 8 пин
const int dg5 = 7; // датчик влажности почвы на 7 пин
const int nasos1 = 2; // управление насосом на 2 пин
const int nasos2 = 3; // управление насосом на 3 пин
const int nasos3 = 4; // управление насосом на 4 пин
const int nasos4 = 5; // управление насосом на 5 пин
const int nasos5 = 6; // управление насосом на 6 пин
const int ledB = 1; // звуковой пъезоэлемент на 1 пин
// переменные
int dwS = 0; // состояние датчика уровня воды
int dgS1 = 0; // состояние датчика уровня влажности почвы Nr1
int dgS2 = 0; // состояние датчика уровня влажности почвы Nr2
int dgS3 = 0; // состояние датчика уровня влажности почвы Nr3
int dgS4 = 0; // состояние датчика уровня влажности почвы Nr4
int dgS5 = 0; // состояние датчика уровня влажности почвы Nr5
//установки
void setup() <
// объявляем пины светодиодов и насоса как выходы:
pinMode(nasos1, OUTPUT);
pinMode(nasos2, OUTPUT);
pinMode(nasos3, OUTPUT);
pinMode(nasos4, OUTPUT);
pinMode(nasos5, OUTPUT);
pinMode(ledB, OUTPUT);
// объявляем пины датчиков и насоса как входы:
pinMode(dw, INPUT);
pinMode(dg1, INPUT);
pinMode(dg2, INPUT);
pinMode(dg3, INPUT);
pinMode(dg4, INPUT);
pinMode(dg5, INPUT);

>
// рабочий цикл
void 1оор() <
// считываем состояния датчика уровня жидкости
dwS = digitalRead(dw);
// если воды мало звуковой пъезоэлемент
if (dwS == LOW)
digitalWrite(ledB, HIGH);
else
digitalWrite(ledB, LOW);
// считываем состояния датчика влажности почвы Nr1
dgS1 = digitalRead(dg1);
// если почва сухая, включаем полив насоса Nr1
if (dgS1 == LOW)
digitalWrite(nasos1, HIGH);
delay(2000);
digitalWrite(nasos1, LOW);
delay(30000);
else
digitalWrite(nasos1, LOW);
// считываем состояния датчика влажности почвы Nr2
dgS2 = digitalRead(dg2);
// если почва сухая, включаем полив насоса Nr2
if (dgS2 == LOW)
digitalWrite(nasos2, HIGH);
delay(2000);
digitalWrite(nasos2, LOW);
delay(30000);
else
digitalWrite(nasos2, LOW);
// считываем состояния датчика влажности почвы Nr3
dgS3 = digitalRead(dg3);
// если почва сухая, включаем полив насоса Nr3
if (dgS3 == LOW)
digitalWrite(nasos3, HIGH);
delay(2000);
digitalWrite(nasos3, LOW);
delay(30000);
else
digitalWrite(nasos3, LOW);
// считываем состояния датчика влажности почвы Nr4
dgS4 = digitalRead(dg4);
// если почва сухая, включаем полив насоса Nr4
if (dgS4 == LOW)
digitalWrite(nasos4, HIGH);
delay(2000);
digitalWrite(nasos4, LOW);
delay(30000);
else
digitalWrite(nasos4, LOW);
// считываем состояния датчика влажности почвы Nr5
dgS5 = digitalRead(dg5);
// если почва сухая, включаем полив насоса Nr5
if (dgS1 == LOW)
digitalWrite(nasos5, HIGH);
delay(2000);
digitalWrite(nasos5, LOW);
delay(30000);
else
digitalWrite(nasos5, LOW);
>

Примитивная до безобразия, но при компиляции выдаёт ошибки:

Arduino: 1.6.5 (Windows 8.1), Board: «Arduino Leonardo»

Cveti_Lacplesa_42_2_5pump:40: error: stray ‘’ in program
Cveti_Lacplesa_42_2_5pump:40: error: stray ‘’ in program
Cveti_Lacplesa_42_2_5pump:40: error: stray ‘’ in program
Cveti_Lacplesa_42_2_5pump:40: error: expected unqualified-id before numeric constant
stray ‘’ in program

This report would have more information with
«Show verbose output during compilation»
enabled in File > Preferences.

Источник

Stray error in с program files

trying a code for a simple game i downloaded. when i run it i get lines and lines of this error:
error stray ‘200’ in program (with different numbers)
— i’m using code::blocks, in case that matters.

what does this mean??
here are the first lines of the code. the first error (one in subject) points to line 36

wow i guess there’s a lot wrong with this code.

I just got the same error doing something different now. In another example, i need to use this line:

#import «C:\Program Files\O2Gfxcore.dll»

does that mean the line is wrong or is the .dll library wrong?

still getting the same error. I even moved the file to c: and used:

and still same error

Switch to forward slash / instead of double-backslashes. It works on Win, and means you don’t have to worry about double-slashes.

Which compiler (and preprocessor) are you using? Does it recognise #import? It’s not part of the C++ standard.

the code (i tried include in place of import, same problem):

warning: #import is a deprecated GCC extension

Um. why are you using #import in that case?

Don’t use import. It seems that your preprocessor doesn’t recognise it.

Don’t a dll file. It’s meaningless. literally copies the entire file you want to include, and puts it into the place where you wrote .

Do not a dll file. I know I already said that, but I get the feeling saying it twice will help.

Why are you trying to a dll file? I think you must have misunderstood what a dll file is.

Источник

  • Forum
  • Beginners
  • Problems with char arrays in dynamic mem

Problems with char arrays in dynamic memory…

I can’t seem to pin down why my program, when run, will puke out this:


... omitted ...
a.cpp:29: error: stray '251' in program
a.cpp:29: error: stray '255' in program
a.cpp:29: error: stray '255' in program
a.cpp:29: error: stray '131' in program
a.cpp:29: error: stray '209' in program
a.cpp:29: error: stray '1' in program
a.cpp:29: error: stray '141' in program
a.cpp:29: error: stray '20' in program
a.cpp:29: error: stray '131' in program
a.cpp:29: error: stray '253' in program
a.cpp:29: error: stray '252' in program
a.cpp:29: error: stray '15' in program
a.cpp:29: error: stray '138' in program
a.cpp:29: error: stray '2' in program
a.cpp:29: error: stray '136' in program
a.cpp:29: error: stray '7' in program
a.cpp:29: error: stray '247' in program
a.cpp:29: error: stray '233' in program
... omitted ...
a.cpp:29: error: stray '236' in program
a.cpp:29: error: stray '128' in program
a.cpp:29: error: stray '233' in program
a.cpp:29: error: stray '186' in program
a.cpp:29: error: stray '149' in program
a.cpp:29: error: stray '255' in program
a.cpp:29: error: stray '255' in program
a.cpp:29:409: warning: null character(s) ignored
a.cpp:29: error: stray '`' in program
a.cpp:29: error: stray '128' in program
a.cpp:29:561: warning: null character(s) ignored
a.cpp:29: error: stray '128' in program
a.cpp:29:565: warning: null character(s) ignored
a.cpp:29: error: stray '128' in program
a.cpp:29:581: warning: null character(s) ignored
a.cpp:29: error: stray '128' in program
a.cpp:29:585: warning: null character(s) ignored
a.cpp:29: error: stray '128' in program
a.cpp:29:609: warning: null character(s) ignored
a.cpp:29: error: stray '134' in program
a.cpp:29: error: stray '128' in program
a.cpp:29:613: warning: null character(s) ignored
a.cpp:29: error: stray '150' in program
a.cpp:29: error: stray '128' in program
a.cpp:29:617: warning: null character(s) ignored
a.cpp:29: error: stray '166' in program
a.cpp:29: error: stray '128' in program
a.cpp:29:621: warning: null character(s) ignored
a.cpp:29: error: stray '180' in program
a.cpp:29: error: stray '128' in program
a.cpp:29:625: warning: null character(s) ignored
a.cpp:29: error: stray '194' in program
a.cpp:29: error: stray '128' in program
a.cpp:29:629: warning: null character(s) ignored
a.cpp:29: error: stray '208' in program
a.cpp:29: error: stray '128' in program
a.cpp:29:637: warning: null character(s) ignored
a.cpp:29:655: warning: null character(s) ignored
a.cpp:29:666: warning: null character(s) ignored
a.cpp:29:681: warning: null character(s) ignored
a.cpp:29:697: warning: null character(s) ignored
a.cpp:29:713: warning: null character(s) ignored
a.cpp:29:727: warning: null character(s) ignored
a.cpp:29:740: warning: null character(s) ignored
a.cpp:29:754: warning: null character(s) ignored
a.cpp:29:761: warning: null character(s) ignored
a.cpp:29:1059: warning: no newline at end of file

I’m using g++ to compile my program, and using g++ within my source to compile another program… my main program compiles with no complaints, but while executing it, I get that stuff spilling out from g++… Had no probs until I tried to use dynamically allocated char arrays, instead of static ones.

Here is my source, with comments. The comments reguarding my problem are within /*** ***/

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
#include <cstdio>
#include <windows.h>
#include <iostream>
#include <sys/stat.h>
using namespace std;

/*** Declare dynamically allocated arrays?? ***/
char *srcFile, *outFile, *execCompile, *execStrip, *execPack;
int x;

// Usage info
void usage(char** argv) {
	cout << "Usage: " << argv[0] << " [FILE]n" << "nOptions:n"
			<< "-h, --helptDisplay this message and exitn" << "nNotes:n"
			<< "Do not use an extension in [FILE].n" << "e.g. '" << argv[0]
			<< " mysource', NOT '" << argv[0] << " mysource.cpp'" << endl;
}
// check if a file exsists
int file_exist(char *filename) {
	struct stat buffer;
	return (stat(filename, &buffer) == 0);
}
// generic error message
int error() {
	cerr << "Error: Unknown" << endl;
	return 1;
}
// generic success message
void done() {
	cout << "Done" << endl;
}

int main(int argc, char** argv) {

	/*** Initialize the dynamically allocated char arrays?? ***/
	srcFile = new char [strlen(argv[1])+6]; // initialize srcFile with the length of argv[1] + ".cpp" + any null terminations
	outFile = new char [strlen(argv[1])+6]; // initialize outFile the same way
	execCompile = new char [strlen(outFile)+strlen(srcFile)+31]; // init execCompile with length of outFile + srcFile + string that it will be put in it + null terms
	execStrip = new char [strlen(outFile)+18]; // init with outFile + string length + nullterms
	execPack = new char [strlen(outFile)+37]; // init with outFile + string length + nullterms

	sprintf(srcFile, "%s.cpp", argv[1]); // print "argv[1].cpp" to srcFile
	sprintf(outFile, "%s.exe", argv[1]); // same thing
	if (argc > 1) {
		if (strstr(argv[1], "-h")) { // find -h in argv[1]
			usage(argv); // print help & usage info
			return 0;
		}
		sprintf(execCompile, "g++ -Wall -Os -o %s %s", outFile, srcFile); // print "g++ -Wall -Os -o outFile.exe inFile.cpp" to execCompile
		sprintf(execStrip, "strip %s", outFile); // printf "strip outFile" to execStrip
		sprintf(execPack, "upx --best --ultra-brute %s", outFile); // print "upx --best --ultra-brtue outFile.exe" to execPack
		if (file_exist(srcFile)) { // check if specified file exsists
			cout << "Compiling ... ";
			x = system(execCompile); // execute command line to compile srcFile
			if (x == 0) done();
			else error();
			cout << "Stripping ... ";
			x = system(execStrip); // execute CL to strip the resulting executable
			if (x == 0) done();
			else error();
			cout << "Packing   ... ";
			x = system(execPack); // execute CL to pack the resulting exe
			if (x == 0) done();
			else error();
		} else {
			cerr << "Error: " << srcFile << ": No such file" << endl; // error if file doesn't exsist
			return 1;
		}

	} else {
		cerr << "Error: No file specified" << endl; // error if no filename was given on CL
		cout << "Type " << argv[0] << " --help for more info." << endl;
		return 1;
	}

	/*** Clear out the memory allocations?? ***/
	delete[] srcFile;
	delete[] outFile;
	delete[] execCompile;
	delete[] execStrip;
	delete[] execPack;
	return 0;
}

/*
 * TODO: Prompt for filename if not specified in CL arg.
 * TODO: Support working with multiple files.
 * TODO: Use dynamically allocated char arrays
 * TODO: Add more options for output control
 * TODO: Allow specifying '.cpp' in filename
 */

By the way, the program is supposed to use GNU g++ to compile a C/C++ source, then strip it using GNU strip, then pack it using UPX.

Like I said, works fine using static arrays, but I guess I’m not implementing the dynamic arrays correctly or something.

Normally you get that when you have some UTF-8 characters in the file. Try looking with a hex editor at the file and finding these stray characters and deleting them.

Apperently, the cpp was really an exe, it somehow got renamed to .cpp… IDFK how that happened…

So turns out my source was fine. Lol.

Last edited on

Topic archived. No new replies allowed.

Понравилась статья? Поделить с друзьями:
  • Error stray 227 in program
  • Error stray 226 in program
  • Error stray 205 in program
  • Error store option ottplayer
  • Error storage class specified for parameter