Ошибка stray 357 in program

Arduino Forum

Loading

ошибка 357

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

wbi

Offline

Зарегистрирован: 29.03.2018

Почему могут выдаваться ошибки:

……ino:1:1: error: stray ‘357’ in program

……ino:1:1: error: stray ‘273’ in program

……ino:1:1: error: stray ‘277’ in program

в первой строке стоит:

#include <Servo.h>

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

Чт, 29/03/2018 — 05:47

#1

DetSimen

DetSimen аватар

Offline

Зарегистрирован: 25.01.2017

потомушта код скопипижжен из тырнета не в той кодировке. 

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

Чт, 29/03/2018 — 05:49

#2

wbi

Offline

Зарегистрирован: 29.03.2018

А как поменять кодировку?

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

Чт, 29/03/2018 — 05:56

#3

DetSimen

DetSimen аватар

Offline

Зарегистрирован: 25.01.2017

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

Чт, 29/03/2018 — 05:57

#4

wbi

Offline

Зарегистрирован: 29.03.2018

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

Sometimes, when running a complex computational code, a stray ‘357’ error may pop up. This indicates a problem with a byte-encoded character, which can cause your program to crash or malfunction. This article discusses in detail how to detect, diagnose, and fix such an error in your program.

What Causes the ‘357’ Error

The ‘357’ (or octal 0xff) error is generated when a program encounters an unexpected number of bytes. It indicates that something unexpected happened between the time of writing and the time of running the program.

Common causes of the ‘357’ error include:

  • The program code has not been correctly compiled or generated.
  • Unintended byte manipulation has created incorrect byte sequences within the program memory.
  • A third-party library or resource is conflicting with the program’s byte-load sequence.

How to Detect the ‘357’ Error

The easiest way to detect a ‘357’ error is to run your code through a debugger. This will allow you to identify the exact line of code that is generating the error and help you to diagnose the problem more quickly.

If debugging is not possible, you can also attempt to locate the ‘357’ error by searching through your program’s memory. This can be done manually by viewing the program’s bytes in a hexadecimal editor, or through a memory scan tool.

How to Resolve the ‘357’ Error

Once you’ve detected where the error is occurring in your program, you can begin to fix it. First, try recompiling your code, as this will often resolve any compiler-related issues.

If the error persists, stop the program and backup your code before attempting to edit it. You can then begin to systematically examine each area of the program where the ‘357’ error is occurring to understand what the source of the problem could be.

If you suspect that a third-party library or resource is causing the error, it is also a good idea to update or remove the library from your program. Depending on the context, it is sometimes also possible to work around the error by adding additional byte sequences or utilizing a different library.

FAQs

What is a ‘357’ Error?

A ‘357’ (or octal 0xff) error is generated when a program encounters an unexpected number of bytes. It indicates that something unexpected happened between the time of writing and the time of running the program.

What are common causes of the ‘357’ Error?

Common causes of the ‘357’ error include: The program code has not been correctly compiled or generated, unintended byte manipulation has created incorrect byte sequences within the program memory, or a third-party library or resource is conflicting with the program’s byte-load sequence.

How do I detect the ‘357’ Error?

The easiest way to detect a ‘357’ error is to run your code through a debugger. This will allow you to identify the exact line of code that is generating the error and help you to diagnose the problem more quickly.

If debugging is not possible, you can also attempt to locate the ‘357’ error by searching through your program’s memory. This can be done manually by viewing the program’s bytes in a hexadecimal editor, or through a memory scan tool.

How do I resolve the ‘357’ Error?

Once you’ve detected where the error is occurring in your program, you can begin to fix it. First, try recompiling your code, as this will often resolve any compiler-related issues.

If the error persists, stop the program and backup your code before attempting to edit it. You can then begin to systematically examine each area of the program where the ‘357’ error is occurring to understand what the source of the problem could be.

If you suspect that a third-party library or resource is causing the error, it is also a good idea to update or remove the library from your program. Depending on the context, it is sometimes also possible to work around the error by adding additional byte sequences or utilizing a different library.

For further information, you can refer to the following resources:

  • Troubleshooting the ‘357’ Error in Programs
  • How to Troubleshoot Binary Data Interference

Link: http://blog.chinaunix.net/uid-23089249-id-61541.html

I got a few header files from my colleagues. It’s ok to compile with GCC, but a whole bunch of them came up when I compiled with ARM-Linux-gcc!

SerialPort.h:1: error: stray ‘357’ in program

SerialPort.h:1: error: stray ‘273’ in program

SerialPort.h:1: error: stray ‘277’ in program

Look at these errors confused, after looking up the Internet, found that some characters in the file compiler does not support. If you look for these characters one by one, you’ll probably be looking for a long time! The simplest solution:
Put the files into The Windows system, use “Notepad” to open these files, and then “save as”, choose the code ASNI, and then under Linux to re-compile with the compiler, generally can pass!

Experience:

The first time: unknown;

Second time: when compiling QT program, prompt this error; According to the above method solved.

Read More:

I’m really new to the Arduino system, and I’m trying to do a project, which is basically a water quality controller, with multiple sensors (pH, Temperature, Conductivity, Dissolved oxygen etc…) which gives us the values for all these parameters.

The code for this project is already written and adapted to the hardware. This code is composed of multiple files (.h and .ccp), 2 files for each sensors and one main file (.ino) to run the complete system. Here is one example file:

/**********************************************************************************
* GravityEc.h
* Copyright (C)    2017   DFRobot,
* GitHub Link :https://github.com/DFRobot/watermonitor
* This Library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
* Description:Monitoring water quality parameters Conductivity
* Product Links:http://www.dfrobot.com.cn/goods-882.html
* Sensor driver pin:A1 (ecSensorPin(A1))
* author  :  Jason(jason.ling@dfrobot.com)
* version :  V1.0
* date    :  2017-04-17
**********************************************************************/

#pragma once
#include "GravityTemperature.h"
#include "ISensor.h"

// external GravityTemperature ecTemperature;

class GravityEc:public ISensor
{
public:
    // Conductivity sensor pin
    int ecSensorPin;

    // Conductivity values
    double ECcurrent;


public:
    GravityEc(ISensor*);
    ~GravityEc();

    // initialization
    void  setup ();

    // update the sensor data
    void  update ();

    // Get the sensor data
    double getValue();

private:
    // point to the temperature sensor pointer
    ISensor* ecTemperature = NULL;


    static const int numReadings = 5;
    unsigned int readings[numReadings] = { 0 };      // the readings from the analog input
    int index;
    double sum;
    unsigned long AnalogValueTotal;      // the running total
    unsigned int AnalogAverage;
    unsigned int averageVoltage;
    unsigned long AnalogSampleTime;
    unsigned long printTime;
    unsigned  long tempSampleTime;
    unsigned long AnalogSampleInterval;
    unsigned long printInterval ;

    // Calculate the average
  void calculateAnalogAverage();

    // Calculate the conductivity
    void calculateEc();
};

I work on Arduino IDE 2.0.4, Windows 10, and Arduino Uno.

When I try to Verify the code in Arduino IDE, I always get errors like these:

C:UserscamilDesktopKnowFlow_AWM-masterArduinoUnoDoWaterMonitorGravityEc.h:1:1: error: stray '357' in program
 /**********************************************************************************
 ^
C:UserscamilDesktopKnowFlow_AWM-masterArduinoUnoDoWaterMonitorGravityEc.h:1:2: error: stray '273' in program
 /**********************************************************************************
  ^
C:UserscamilDesktopKnowFlow_AWM-masterArduinoUnoDoWaterMonitorGravityEc.h:1:3: error: stray '277' in program
 /**********************************************************************************
   ^

So, I went to some forums and searched for these stray 357, 273 and 277 errors.
I found that these errors were the consequence of the presence of goofy/invisible characters in the code.
So I deleted the lines were the error was found (1st line in every code file), and replaced it by:

/****

Result was the same, I got the same errors.

I also found that you can use the function : Tools > Fix Encoding and Reload, but this function seems to not exist in my version of Arduino IDE (2.0.4). Is it normal? This function is used to find the goofy hidden characters, and could be very nice to fix my problem.

I tried uploading the file again from GitHub. Could this be linked to my version of Arduino IDE? I will try to use a former one.

This seems to be a common issue but I really don’t understand how to get rid of it!

Понравилась статья? Поделить с друзьями:
  • Ошибка stray 342 in program
  • Ошибка stray 320 in program
  • Ошибка stop 0x000000ea windows xp
  • Ошибка stray 253 in program
  • Ошибка stop 0x000000d1 что это