Ошибка stray 253 in program

Студворк — интернет-сервис помощи студентам

Доброго времени суток, написал программу которая рандомит 3 массива и выводит среднее геометрическое отрицательных чисел каждого массива, и она нормально работала, а вот сегодня пытаюсь запустить как вылетает ошибка : ‘stray 253’ in program. Программирую в Dev-C++, пожайлуста, помогите решить что здесь не так.

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
#include <iostream>
#include <cmath>
#include <windows.h>
#include <ctime>
 
using namespace std;
 
class lab
{
private:
int mas[21];
public:
void fillv(int n)
{
 
for( int i(0); i < n ;i++ )
mas[i]= 5 - rand()%10;
}
void printv(int n)
{
for( int i(0) ; i < n ; i++)
cout « mas[i] « " ";
}
void modv(int n)
{
int c = 0;
float dob = 1, h;
for(int i(0); i < n ; i++)
if( mas[i] < 0 ){
c++;
dob *= mas[i];
h = pow(dob,1.0/c);
cout « mas[i] « " ";
}
cout « endl « dob « endl « h;
}
};
 
int main()
{
srand(time(NULL));
cout « endl « " 1 ARR : " « endl;
int n = 17;
lab mat;
mat.fillv(n);
cout « endl;
mat.printv(n);
cout « endl;
mat.modv(n);
cout « endl;
//
cout « endl « " 2 ARR :" « endl;
n = 19;
mat.fillv(n);
cout « endl;
mat.printv(n);
cout « endl;
mat.modv(n);
cout « endl;
//
cout « endl « "3 ARR :" « endl;
n = 21;
mat.fillv(n);
cout « endl;
mat.printv(n);
cout « endl;
mat.modv(n);
cout « endl;
 
 
return 0;
}

I wrote up a string of code that checks if a given number n, is prime or not, and returns true or false accordingly.

#include <iostream>

using namespace std;

bool primeChecker(int n) {
  int ul = n;
  int x;

  for (int f = 2; f < n; f++) {
    if (f >= ul) {
      break;
    }
    x = n % f;
    if (x == 0) {
      cout « n « " is not prime." « endl;
      return false;
    }
    else {
      ul = n/f+1;
    }
  }
  cout « n « " is prime." « endl;
  return true;
}

int main()
{
  int n = 90;

  cout « primeChecker(n) « endl;

  return 0;
}

When I try to compile it using cygwin with g++ std=c++11 -o PrimeChecker.cpp it gives me a whole lot of errors such as stray '253' in program and stray '302' in program on lines 15, 22, 30 (which are all the lines with the cout statements)

I do not understand what is wrong here. It looks to me as if I have everything written correctly.

  • Печать

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

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

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

Сообщение 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 FilesO2Gfxcore.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.

Источник

Asked
7 years, 2 months ago

Viewed
765 times

I wrote a program using nano and tried to compile it using gcc command on Lx-terminal. It’s showing stray error. Can anyone tell me what is the problem? For simple «hello world» program also is showing errors.

Code:

#include<stdio.h>
main()
{
printf(hello world;
}

Output:

ello.c:49:14: error: stray 253 in program
hello.c:49:14: error: stray 217 in program
hello.c:49:14: error: stray 33 in program
hello.c:49:14: error: stray 1 in program
hello.c:49:939: warning: null character(s) ignored
hello.c:49:14: error: stray 4 in program
hello.c:49:943: warning: null character(s) ignored
hello.c:49:14: error: stray 25 in program
hello.c:49:946: warning: null character(s) ignored
hello.c:49:14: error: stray 5 in program
hello.c:49:14: error: stray 6 in program
hello.c:49:988: warning: null character(s) ignored
hello.c:49:14: error: stray 21 in program
hello.c:49:993: warning: null character(s) ignored
hello.c:49:14: error: stray 21 in program
hello.c:49:995: warning: null character(s) ignored
hello.c:49:14: error: stray 4 in program
hello.c:49:998: warning: null character(s) ignored
hello.c:49:1002: warning: null character(s) ignored
ello.c:49:14: error: stray ‘253’ in program
hello.c:49:14: error: stray ‘217’ in program
hello.c:49:14: error: stray ‘33’ in program
hello.c:49:14: error: stray ‘1’ in program
hello.c:49:939: warning: null character(s) ignored
hello.c:49:14: error: stray ‘4’ in program
hello.c:49:943: warning: null character(s) ignored
hello.c:49:14: error: stray ‘25’ in program
hello.c:49:946: warning: null character(s) ignored
hello.c:49:14: error: stray ‘5’ in program
hello.c:49:14: error: stray ‘6’ in program
hello.c:49:988: warning: null character(s) ignored
hello.c:49:14: error: stray ‘21’ in program
hello.c:49:993: warning: null character(s) ignored
hello.c:49:14: error: stray ‘21’ in program
hello.c:49:995: warning: null character(s) ignored
hello.c:49:14: error: stray ‘4’ in program
hello.c:49:998: warning: null character(s) ignored
hello.c:49:1002: warning: null character(s) ignored
ello.c:49:14: error: stray 253 in program
hello.c:49:14: error: stray 217 in program
hello.c:49:14: error: stray 33 in program
hello.c:49:14: error: stray 1 in program
hello.c:49:939: warning: null character(s) ignored
hello.c:49:14: error: stray 4 in program
hello.c:49:943: warning: null character(s) ignored
hello.c:49:14: error: stray 25 in program
hello.c:49:946: warning: null character(s) ignored
hello.c:49:14: error: stray 5 in program
hello.c:49:14: error: stray 6 in program
hello.c:49:988: warning: null character(s) ignored
hello.c:49:14: error: stray 21 in program
hello.c:49:993: warning: null character(s) ignored
hello.c:49:14: error: stray 21 in program
hello.c:49:995: warning: null character(s) ignored
hello.c:49:14: error: stray 4 in program
hello.c:49:998: warning: null character(s) ignored
hello.c:49:1002: warning: null character(s) ignored
ello.c:49:14: error: stray 253 in program
hello.c:49:14: error: stray 217 in program
hello.c:49:14: error: stray 33 in program
hello.c:49:14: error: stray 1 in program
hello.c:49:939: warning: null character(s) ignored
hello.c:49:14: error: stray 4 in program
hello.c:49:943: warning: null character(s) ignored
hello.c:49:14: error: stray 25 in program
hello.c:49:946: warning: null character(s) ignored
hello.c:49:14: error: stray 5 in program
hello.c:49:14: error: stray 6 in program
hello.c:49:988: warning: null character(s) ignored
hello.c:49:14: error: stray 21 in program
hello.c:49:993: warning: null character(s) ignored
hello.c:49:14: error: stray 21 in program
hello.c:49:995: warning: null character(s) ignored
hello.c:49:14: error: stray 4 in program
hello.c:49:998: warning: null character(s) ignored
hello.c:49:1002: warning: null character(s) ignored

Steve Robillard's user avatar

asked Apr 11, 2016 at 9:45

user42939's user avatar

1

The problem is with your printf line.

printf(hello world;

you are missing the closing parenthesis «)«, You are also missing quotes around the text «Hello World»

change that line to:

printf("hello world");

Your final code should look like this

#include<stdio.h>
main()
{
  printf("hello world");
}

You can then compile it with this command:

gcc -o helloworld helloworld.c

You should now have an executable called helloworld that can be run by typing:

./helloworld

answered Apr 11, 2016 at 10:37

Steve Robillard's user avatar

Steve RobillardSteve Robillard

34.4k17 gold badges103 silver badges109 bronze badges

2

Понравилась статья? Поделить с друзьями:
  • Ошибка stop 0x000000d1 что это
  • Ошибка strawberrybeard sea of thieves
  • Ошибка stop 0x000000d1 windows 7 как исправить
  • Ошибка str object does not support item assignment
  • Ошибка stop 0x000000a5 при установке windows