I’m getting these errors in my program after pasting in some code:
showdata.cpp:66: error: stray ‘342’ in program
showdata.cpp:66: error: stray ‘200’ in program
showdata.cpp:66: error: stray ‘235’ in program
showdata.cpp:66: error: stray ‘’ in program
showdata.cpp:66: error: stray ‘342’ in program
showdata.cpp:66: error: stray ‘200’ in program
showdata.cpp:66: error: stray ‘235’ in program
showdata.cpp:67: error: stray ‘342’ in program
showdata.cpp:67: error: stray ‘200’ in program
showdata.cpp:67: error: stray ‘235’ in program
showdata.cpp:67: error: stray ‘’ in program
showdata.cpp:67: error: stray ‘342’ in program
showdata.cpp:67: error: stray ‘200’ in program
showdata.cpp:67: error: stray ‘235’ in program
Here are the two lines that are causing the errors.
size_t startpos = str.find_first_not_of(” t”);
size_t endpos = str.find_last_not_of(” t”);
How can I fix this?
![]()
asked Feb 26, 2010 at 10:35
neuromancerneuromancer
52.7k77 gold badges166 silver badges222 bronze badges
2
The symbol ” is not ". Those are called ‘smart quotes’ and are usually found in rich documents or blogs.
answered Feb 26, 2010 at 10:38
5
The lines
size_t startpos = str.find_first_not_of(” t”);
size_t endpos = str.find_last_not_of(” t”);
have some «special» kind of double quotes, try the following:
size_t startpos = str.find_first_not_of(" t");
size_t endpos = str.find_last_not_of(" t");
answered Feb 26, 2010 at 10:38
hlovdalhlovdal
25.5k10 gold badges93 silver badges162 bronze badges
This sort of error message, error: stray ‘xyz’ in program, can appear with any other character or symbol that is not recognized by the compiler as a legal one.
Sharing my personal experience:
- bool less<const char∗>(const char∗ a, const char∗ b)
- bool less<const char*>(const char* a, const char* b)
The former one is copy-pasted from a PDF file. It doesn’t compile.
The latter one compiles as expected.
![]()
answered Aug 31, 2017 at 11:12
Saurav SahuSaurav Sahu
12.4k5 gold badges58 silver badges78 bronze badges
0
You can use the sed command to fix these issues.
This will give you a quick preview of what will be replaced.
sed s/[”“]/'"'/g File.txt
This will do the replacements and put the replacement in a new file called WithoutSmartQuotes.txt.
sed s/[”“]/'"'/g File.txt > WithoutSmartQuotes.txt
This will overwrite the original file.
sed -i ".bk" s/[”“]/'"'/g File.txt
answered Nov 13, 2014 at 13:27
cokedudecokedude
3591 gold badge10 silver badges20 bronze badges
2
You’re enclosing your string in the wrong kind of quotes.
You have:
“Hello Worldn”
You should instead have:
"Hello Worldn"
While the quotes you’ve used look similar, they are not recognized by a C compiler as enclosing a string. Thus, you get error messages about unrecognized Unicode characters, and you get error messages showing that the contents of the string are being interpreted as unquoted program code.
You will note that the quotes you’ve used have separate characters for beginning and ending a quotation (they are curved the way quotes are often typeset). Many word processors—as Jobin suggested—will automatically turn simple " quotes into such fancy quotation marks. If you’re using a word processor to compose C programs, you should use a text editor instead.
Ubuntu comes with gedit installed by default (though there are many other text editors to choose from, too). Like many text editors, gedit provides syntax highlighting for many programming languages including C (so different text in your program will shown in different colors to signify its meaning), which is a handy feature and makes a text editor much more convenient and user-friendly for programming than a word processor.
This might be Ubuntu-specific, if you’re used to a text editor on another platform that automatically reduces pasted quotations marks to the non-fancy version. But this question might end up getting closed and migrated to Stack Overflow.
When I try to compile my code it says «stray ‘342’ in program
My code:
#include <IRremote2.h>
#include <IRremoteInt.h>
#define pinIN 11
uint32_t val;
uint32_t prev;
int fre = 0;
IRrecv remote(pinIN);
decode_results result;
void setup() {
Serial.begin(9600);
remote.enableIRIn();
pinMode(2, OUTPUT);
}
void loop() {
if (remote.decode(&result)) {
val = result.value;
if (val == 0xFFFFFFFF) {
val = prev;
}
prev = val;
detekceKlaves();
remote.resume();
}
}
void detekceKlaves() {
switch (val, HEX) {
case 0x807FB24D:
Serial.println("Stisknuto PLAY");
tone(2, fre);
break;
case 0x807FB04F:
Serial.println("Stisknuto STOP");
noTone(2);
break;
case 0x807F18E7:
Serial.println("Stisknuto VOL+");
fre += 10;
break;
case 0x807F906F:
Serial.println("Stisknuto VOL-");
fre -= 10;
break;
case 0x807F9867:
Serial.println("Stisknuto OFF/ON");
fre = 0;
break;
default:
Serial.println("Stisknuta jina klavesa");
}
}
Error code:
Arduino: 1.8.10 (Windows 10), Board: "Arduino Uno"
irTEST:43:20: error: stray '342' in program
case 0x807FB24D:
^
irTEST:43:21: error: stray '200' in program
case 0x807FB24D:
^
irTEST:43:22: error: stray '254' in program
case 0x807FB24D:
^
irTEST:47:10: error: stray '342' in program
case 0x807FB04F:
^
irTEST:47:11: error: stray '200' in program
case 0x807FB04F:
^
irTEST:47:12: error: stray '255' in program
case 0x807FB04F:
^
irTEST:47:23: error: stray '342' in program
case 0x807FB04F:
^
irTEST:47:24: error: stray '200' in program
case 0x807FB04F:
^
irTEST:47:25: error: stray '254' in program
case 0x807FB04F:
^
C:UsersmaximDocumentsArduinoirTESTirTEST.ino: In function 'void detekceKlaves()':
C:UsersmaximDocumentsArduinoirTESTirTEST.ino:43:5: warning: overflow in implicit constant conversion [-Woverflow]
case 0x807FB24D:
^~~~
C:UsersmaximDocumentsArduinoirTESTirTEST.ino:47:5: warning: overflow in implicit constant conversion [-Woverflow]
case 0x807FB04F:
^~~~
C:UsersmaximDocumentsArduinoirTESTirTEST.ino:51:5: warning: overflow in implicit constant conversion [-Woverflow]
case 0x807F18E7:
^~~~
C:UsersmaximDocumentsArduinoirTESTirTEST.ino:55:5: warning: overflow in implicit constant conversion [-Woverflow]
case 0x807F906F:
^~~~
C:UsersmaximDocumentsArduinoirTESTirTEST.ino:59:5: warning: overflow in implicit constant conversion [-Woverflow]
case 0x807F9867:
^~~~
Multiple libraries were found for "IRremote2.h"
Used: C:UsersmaximDocumentsArduinolibrariesIRremote2
exit status 1
stray '342' in program
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Please help
asked Dec 29, 2019 at 14:14
3
If I copy your provided code in a vim-editor you can see some strange characters. <202c>
switch (val, HEX) {
4
5 case 0x807FB24D<202c>:
6 Serial.println("Stisknuto PLAY");
7 tone(2, fre);
8 break;
9 case <202d>0x807FB04F<202c>:
I’ve removed them for you:
#include <IRremote2.h>
#include <IRremoteInt.h>
#define pinIN 11
uint32_t val;
uint32_t prev;
int fre = 0;
IRrecv remote(pinIN);
decode_results result;
void setup()
{
Serial.begin(9600);
remote.enableIRIn();
pinMode(2, OUTPUT);
}
void loop()
{
if (remote.decode(&result))
{
val = result.value;
if (val == 0xFFFFFFFF)
{
val = prev;
}
prev = val;
detekceKlaves();
remote.resume();
}
}
void detekceKlaves()
{
switch (val, HEX)
{
case 0x807FB24D:
Serial.println("Stisknuto PLAY");
tone(2, fre);
break;
case 0x807FB04F:
Serial.println("Stisknuto STOP");
noTone(2);
break;
case 0x807F18E7:
Serial.println("Stisknuto VOL+");
fre += 10;
break;
case 0x807F906F:
Serial.println("Stisknuto VOL-");
fre -= 10;
break;
case 0x807F9867:
Serial.println("Stisknuto OFF/ON");
fre = 0;
break;
default:
Serial.println("Stisknuta jina klavesa");
}
}
answered Dec 29, 2019 at 15:57
![]()
2
trying to build project from chapter 8 MultithreadedCV in QtCreator under Archlinux I got :
/usr/bin/uic ../MultithreadedCV/mainwindow.ui -o ui_mainwindow.h
g++ -c -pipe -g -Wall -W -D_REENTRANT -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../MultithreadedCV -I. -isystem /usr/local/include/opencv -isystem /usr/local/include -isystem /usr/include/qt -isystem /usr/include/qt/QtWidgets -isystem /usr/include/qt/QtGui -isystem /usr/include/qt/QtCore -I. -isystem /usr/include/libdrm -I. -I/usr/lib/qt/mkspecs/linux-g++ -o main.o ../MultithreadedCV/main.cpp
../MultithreadedCV/main.cpp:26:16: error: stray ‘342’ in program
return “”;
^
../MultithreadedCV/main.cpp:26:17: error: stray ‘200’ in program
return “”;
^
../MultithreadedCV/main.cpp:26:18: error: stray ‘234’ in program
return “”;
^
../MultithreadedCV/main.cpp:26:19: error: stray ‘342’ in program
return “”;
^
../MultithreadedCV/main.cpp:26:20: error: stray ‘200’ in program
return “”;
^
../MultithreadedCV/main.cpp:26:21: error: stray ‘235’ in program
return “”;
^
../MultithreadedCV/main.cpp:32:31: error: stray ‘342’ in program
QString(“”).toStdWString().c_str(),
^
../MultithreadedCV/main.cpp:32:32: error: stray ‘200’ in program
QString(“”).toStdWString().c_str(),
^
../MultithreadedCV/main.cpp:32:33: error: stray ‘234’ in program
QString(“”).toStdWString().c_str(),
^
../MultithreadedCV/main.cpp:32:34: error: stray ‘’ in program
QString(“”).toStdWString().c_str(),
^
../MultithreadedCV/main.cpp:32:35: error: stray ‘342’ in program
QString(“”).toStdWString().c_str(),
^
../MultithreadedCV/main.cpp:32:36: error: stray ‘200’ in program
QString(“”).toStdWString().c_str(),
^
../MultithreadedCV/main.cpp:32:37: error: stray ‘235’ in program
QString(“”).toStdWString().c_str(),
^
../MultithreadedCV/main.cpp: In function ‘QString getVersionString(QString)’:
../MultithreadedCV/main.cpp:18:5: error: ‘DWORD’ was not declared in this scope
DWORD dwHandle;
^~~~~
../MultithreadedCV/main.cpp:19:11: error: expected ‘;’ before ‘dwLen’
DWORD dwLen = GetFileVersionInfoSize(fName.toStdWString().c_str(), &dwHandle);
^~~~~
../MultithreadedCV/main.cpp:21:5: error: ‘LPVOID’ was not declared in this scope
LPVOID lpData = new BYTE[dwLen];
^~~~~~
../MultithreadedCV/main.cpp:22:58: error: ‘dwHandle’ was not declared in this scope
if(!GetFileVersionInfo(fName.toStdWString().c_str(), dwHandle, dwLen, lpData))
^~~~~~~~
../MultithreadedCV/main.cpp:22:58: note: suggested alternative: ‘drand48’
if(!GetFileVersionInfo(fName.toStdWString().c_str(), dwHandle, dwLen, lpData))
^~~~~~~~
drand48
../MultithreadedCV/main.cpp:22:68: error: ‘dwLen’ was not declared in this scope
if(!GetFileVersionInfo(fName.toStdWString().c_str(), dwHandle, dwLen, lpData))
^~~~~
../MultithreadedCV/main.cpp:22:75: error: ‘lpData’ was not declared in this scope
if(!GetFileVersionInfo(fName.toStdWString().c_str(), dwHandle, dwLen, lpData))
^~~~~~
../MultithreadedCV/main.cpp:22:75: note: suggested alternative: ‘QMapData’
if(!GetFileVersionInfo(fName.toStdWString().c_str(), dwHandle, dwLen, lpData))
^~~~~~
QMapData
../MultithreadedCV/main.cpp:22:9: error: ‘GetFileVersionInfo’ was not declared in this scope
if(!GetFileVersionInfo(fName.toStdWString().c_str(), dwHandle, dwLen, lpData))
^~~~~~~~~~~~~~~~~~
../MultithreadedCV/main.cpp:25:18: error: type ‘<type error>’ argument given to ‘delete’, expected pointer
delete[] lpData;
^~~~~~
../MultithreadedCV/main.cpp:26:9: error: return-statement with no value, in function returning ‘QString’ [-fpermissive]
return “”;
^~~~~~
../MultithreadedCV/main.cpp:29:5: error: ‘VS_FIXEDFILEINFO’ was not declared in this scope
VS_FIXEDFILEINFO *lpBuffer = NULL;
^~~~~~~~~~~~~~~~
../MultithreadedCV/main.cpp:29:23: error: ‘lpBuffer’ was not declared in this scope
VS_FIXEDFILEINFO *lpBuffer = NULL;
^~~~~~~~
../MultithreadedCV/main.cpp:29:23: note: suggested alternative: ‘setbuffer’
VS_FIXEDFILEINFO *lpBuffer = NULL;
^~~~~~~~
setbuffer
../MultithreadedCV/main.cpp:30:5: error: ‘UINT’ was not declared in this scope
UINT uLen;
^~~~
../MultithreadedCV/main.cpp:30:5: note: suggested alternative: ‘MIN’
UINT uLen;
^~~~
MIN
../MultithreadedCV/main.cpp:31:23: error: ‘lpData’ was not declared in this scope
if(!VerQueryValue(lpData,
^~~~~~
../MultithreadedCV/main.cpp:31:23: note: suggested alternative: ‘QMapData’
if(!VerQueryValue(lpData,
^~~~~~
QMapData
../MultithreadedCV/main.cpp:33:31: error: expected primary-expression before ‘)’ token
(LPVOID*)&lpBuffer,
^
../MultithreadedCV/main.cpp:34:24: error: ‘uLen’ was not declared in this scope
&uLen))
^~~~
../MultithreadedCV/main.cpp:34:24: note: suggested alternative: ‘QPen’
&uL``en))
^~~~
QPen
../MultithreadedCV/main.cpp:31:9: error: ‘VerQueryValue’ was not declared in this scope
if(!VerQueryValue(lpData,
^~~~~~~~~~~~~
../MultithreadedCV/main.cpp:42:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
make: *** [Makefile:603: main.o] Error 1
16:51:15: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project MultithreadedCV (kit: Desktop)
When executing step "Make"
16:51:15: Elapsed time: 00:03.
- Forum
- Beginners
- error: stray ‘342’ in program
error: stray ‘342’ in program
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
|
|
thank you!!
Last edited on
Well, it is because there are “ and ” instead of » (note the slant!), and these characters are not valid.
………. it’s always the little things that matter 🙂
cin >> not <<
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?
Do you not notice the single backslash before fxcore.dll?
still getting the same error. I even moved the file to c: and used:
#import "C:\fxcore.dll"
and still same error
Could you copy and paste the error exactly?
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):
|
|
the error:
|
|
warning: #import is a deprecated GCC extension
Um…why are you using #import in that case?
Last edited on
Don’t use import. It seems that your preprocessor doesn’t recognise it.
Don’t #include a dll file. It’s meaningless. #include literally copies the entire file you want to include, and puts it into the place where you wrote #include .
Do not #include a dll file. I know I already said that, but I get the feeling saying it twice will help.
Why are you trying to #include a dll file? I think you must have misunderstood what a dll file is.
Last edited on
Topic archived. No new replies allowed.