Error close was not declared in this scope

I am cross compiling (host: x86 linux) for raspberry pi (ARM) using arm-bcm2708hardfp-linux-gnueabi-g++ When I choose g++ it all works out fine and compiles. But when cross compiling I get: err...

I am cross compiling (host: x86 linux) for raspberry pi (ARM) using

arm-bcm2708hardfp-linux-gnueabi-g++

When I choose g++ it all works out fine and compiles.
But when cross compiling I get:

 error: 'close' was not declared in this scope

This is the simplified source code

#include <iostream>
#include <fcntl.h>

using namespace std;
int fd;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    close(fd);
    return 0;
}

Any idea? Did I forget to include smth? I am using eclipse as IDE.

asked Aug 28, 2012 at 12:56

tzippy's user avatar

I believe it’s as simple as this: close is declared in <unistd.h>, not <fcntl.h>. To find out what header file declares a symbol, you should always check the man pages first.

#include <iostream>
#include <unistd.h>  // problem solved! it compiles!

using namespace std;
int fd;

int main() {
    cout << "!!!Hello World!!!" << endl; // prints !!!Hello World!!!
    close(fd);  // but explicitly closing fd 0 (stdin) is not a good idea anyway
    return 0;
}

answered Oct 10, 2012 at 18:28

Quuxplusone's user avatar

QuuxplusoneQuuxplusone

23.1k7 gold badges90 silver badges152 bronze badges

3

This topic has been deleted. Only users with topic management privileges can see it.

  • Find the code below. What i am doing wrong. The similar code works in plain GCC compliling. Brings the error close() was not declared in this scope. The same for write() . open() is Ok.

    @#ifndef KSEG_DH
    #define KSEG_DH

    #include «QtGlobal»
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <sys/param.h>
    #include <sys/ioctl.h>
    #include <sys/types.h>
    #include </usr/include/sys/io.h>
    #include <sys/stat.h>
    #include <sys/errno.h>
    #include </usr/include/sys/fcntl.h>
    #include </usr/include/linux/mtio.h>
    …..
    #include «KSEG_D.h»
    …..
    int KSEG_D::CloseOutTape()
    {
    close( idOutTape );
    return 0;
    }@

  • Do you mind to enlighten us and tell us the tool chain where the compile fails?

  • Exactly.

  • @#include </usr/include/sys/io.h>@

    is not a good idea:-) The compiler checks all the include pathes for the files you give and /usr/include is in the list of include pathes on any decent unix-based system. sys/types.h is already found and most likely located right next to sys/io.h.

    Are you planing on asking here about each and every method you need to include somewhere? You were the guy that asked about ioctl before, aren’t you? Please check the documentation of the methods you use for the include files needed (or check /usr/include manually, or read a book, or check the working non-Qt code you have).

  • Thank you. You are so kind. I never asked if i am not sure that i tryed everything i can find out. Some people not so smart and need help

  • Ok, sorry if I was patronizing, but your question led me to believe that you did none of the following:

    check the documentation, e.g. by doing «man 2 close» to get the man page (assuming you are on a unix-oid OS, going by you including /usr/include)?

    check a book on C programming. close/open/write/read are pretty well described in any of them. C++ books on the other hand tend to not cover them to extensively since C++ provides more high level directives for file handling. Qt has some even more high level classes for that, too.

    google for «close function in linux»? That gets you the man page as the first hit.

    run «grep write /usr/include»? That will get you lots of hits, so that is most likely not the preferred way to go;-)

  • Thank you. I was out of the office, so can not reply promptly. The problem solved. Brief description:

    1. I could not find ioctl.h. It was really stupid error – I was testing the application on Widows platform that is not proper for ioctl
    2. The error aroused during compilation as close() ( read(), write() ) is not defined. In Linux to use this in *.cpp mtio.h needs to be included.
  • I’m getting a bunch of compile errors similar to those shown below (examples show ‘close’ but I also get similar errors on ‘read’ and ‘write’ function calls). The exact same code compiles on Ubuntu 64-bit/32-bit and Cygwin etc. Also, I am not getting any errors about missing header files etc.

    In member function ‘……’
    AccessMethod.cpp:145:17: error: ‘close’ was not declared in this scope

    In constructor ‘SocketAccessMethod::SAM(const char*, const char*)’:
    AccessMethod.cpp:NNN:MM: error: ‘close’ was not declared in this scope

    These are the included headers:

    #include «AccessMethod.h»
    #include «RegSet.h»
    #include «Common/Logger.h»
    // local access method
    #include <sys/types.h>
    #include <cstdio>
    #include <cstring>
    #include <cstdlib>
    #include <stdexcept>
    // socket access method
    #ifdef WIN32
    #include <winsock2.h>
    #include <ws2tcpip.h>
    #else
    #include <arpa/inet.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <fcntl.h>
    #include <netdb.h>
    #include <cerrno>
    #endif

    System info: Linux utopia 3.3.5-1-ARCH ….. x86_64 Intel(R) Core(TM) i5 CPU M 560 running inside Virtual Box 4.1.14.

    I am sorry I cannot post the code here as I would need to check company rules but I hope somebody can help. If there is other additional info that would help (installed packages etc.), I can provide that. TIA.

    Last edited by arch_itect (2012-05-12 05:49:56)

    SergeyKagen

    3 / 4 / 2

    Регистрация: 02.04.2018

    Сообщений: 315

    1

    19.04.2019, 22:16. Показов 131576. Ответов 14

    Метки нет (Все метки)


    Простой код, но Arduino IDE напрочь отказывается принимать переменные. Что за глюк или я что-то неправильно делаю?

    C++
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    
    void setup() {
      
      Serial.begin(9600);
      int count = 0;
      pinMode(7, INPUT);
      pinMode(13, OUTPUT);
     
    }
     
    void loop() {
     
      if( digitalRead(7) == HIGH ){ 
        
        while(1){ 
          delayMicroseconds(2); 
          count++;  
          if( digitalRead(7) == LOW ){ Serial.println(count); count = 0; break; }
          }
        }  
    }

    ошибка при компиляции «‘count’ was not declared in this scope», что не так?

    __________________
    Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



    0



    marat_miaki

    495 / 389 / 186

    Регистрация: 08.04.2013

    Сообщений: 1,688

    19.04.2019, 23:26

    2

    Лучший ответ Сообщение было отмечено SergeyKagen как решение

    Решение

    C++
    1
    2
    3
    4
    5
    6
    7
    8
    
      int count = 0; //глобальная переменная
     
      void setup() {
       Serial.begin(9600);
      pinMode(7, INPUT);
      pinMode(13, OUTPUT);
     
    }



    1



    Lavad

    0 / 0 / 0

    Регистрация: 03.10.2015

    Сообщений: 25

    14.09.2019, 22:33

    3

    Доброго времени суток!
    У меня то же сообщение, но на функцию :-(
    Создал функцию (за пределами setup и loop), которая только принимает вызов, ничего не возвращает:

    C++
    1
    2
    3
    4
    5
    
    void myDispay(byte x, byte y, char str) {
      lcd.setCursor(x, y);
      lcd.print(temp, 1);   // выводим данные, с точностью до 1 знака после запятой
      lcd.print(str);   // выводим писанину
      }

    В loop() делаю вызов:

    C++
    1
    
    myDisplay(0,0,"C");

    При компиляции выделяется этот вызов, с сообщением:

    ‘myDisplay’ was not declared in this scope

    Замучился искать инфу о декларации/обьявлении функции. Везде, что находил, понимал одно: если ты вызываешь функцию, это и есть обьявление функции
    Что делаю не так? В чем моя ошибка? Помогите, пожалуйста.

    P.S. Код, что использовал в качестве функции, работоспособен. Раньше находился в loop(). Скетч постепенно разрастается, много однотипных обращений к дисплею…



    0



    Эксперт С++

    8385 / 6147 / 615

    Регистрация: 10.12.2010

    Сообщений: 28,683

    Записей в блоге: 30

    14.09.2019, 23:57

    4

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    Создал функцию (за пределами setup и loop),

    Перевидите на нормальный язык.
    Какие еще пределы?

    В другом файле что ли?

    Добавлено через 1 минуту

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    Замучился искать инфу о декларации/обьявлении функции. Везде, что находил, понимал одно: если ты вызываешь функцию, это и есть обьявление функции
    Что делаю не так? В чем моя ошибка? Помогите, пожалуйста

    Читать учебники по С++ не пробовали?

    https://metanit.com/cpp/tutorial/3.1.php
    http://cppstudio.com/post/5291/

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

    Добавлено через 7 минут
    Кроме того иногда потеряй скобок {} приводят к таким ошибкам.



    0



    ValeryS

    Модератор

    Эксперт по электронике

    8759 / 6549 / 887

    Регистрация: 14.02.2011

    Сообщений: 22,972

    15.09.2019, 00:09

    5

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    Везде, что находил, понимал одно: если ты вызываешь функцию, это и есть обьявление функции

    это где ж такое написано?
    функцию нужно объявить перед первым вызовом, сиречь сверху
    можно и просто декларировать сверху

    C++
    1
    
    void myDispay(byte x, byte y, char str);

    а объявить уже в удобном месте



    0



    0 / 0 / 0

    Регистрация: 03.10.2015

    Сообщений: 25

    15.09.2019, 00:48

    6

    Неделю назад ВПЕРВЫЕ включил Arduino Uno.
    Задолго до этого писал программы под Windows (БейсикВизуал) и AVR (Basic, немного Assembler). Т.е. имеется некоторое представление об объявлении переменных, функций,… От Си всегда держался как можно дальше. Это первая и последняя причина «нечитания» книг по Си. За неделю экспериментов на Arduino мнение об этом пока не изменилось — легче вернуться к Ассму, чем копаться в Си.

    Написал на том же языке, что и читал на всяких форумах и справочниках по Arduino :-). За пределами этих функций — значит не внутри них.

    Обе приведенных Вами ссылок просмотрел, проверил в скетче… В итоге вылезла другая ошибка:
    function ‘void myDisplay(byte, byte, char)’ is initialized like a variable

    void myDisplay(byte x, byte y, char str) тоже пробовал. Та же ошибка.

    Что не так на этот раз? :-(



    0



    Модератор

    Эксперт по электронике

    8759 / 6549 / 887

    Регистрация: 14.02.2011

    Сообщений: 22,972

    15.09.2019, 01:26

    7

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    В итоге вылезла другая ошибка:
    function ‘void myDisplay(byte, byte, char)’ is initialized like a variable

    точку с запятой в конце поставил?



    1



    Lavad

    0 / 0 / 0

    Регистрация: 03.10.2015

    Сообщений: 25

    15.09.2019, 08:46

    8

    Вот скетч. Проще некуда.

    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
    
    #include <PCD8544.h>
     
    float temp = 0;
    static PCD8544 lcd;   // даем имя подключенному дисплею (lcd)
    static const byte Lm35Pin = 14;   // аналоговый пин (A0) Arduino, к которому подключен LM35
     
    //void myDisplay() = 0;
    //void myDisplay(byte, byte, char, float) = 0;
    //void myDisplay(byte x, byte y, char str, float temp) = 0;
     
    void myDispay(byte x, byte y, char str, float temp) {
      lcd.setCursor(x, y);   // начиная с (x,y)...
      lcd.print(temp, 1);   // выводим temp
      lcd.print(str);   // выводим писанину
    }
     
    void setup() {
      lcd.begin(84, 48);   // инициализируем дисплей
      analogReference(INTERNAL);   // подключаем внутренний ИОН на 1.1V
    }
     
    void loop() {
      float temp = analogRead(Lm35Pin) / 9.31;  // подсчитываем температуру (в Цельсиях)...
      myDisplay(0, 0, "C", temp);   // отправляем данные на экран
      delay(500);   // ждем 500 мсек
    }

    Любое из трех так называемых «объявлений» (строки 7…9) выдает одну и ту же ошибку — я пытаюсь объявить функцию как переменную.

    Добавлено через 9 минут
    Попробовал так:

    C++
    1
    
    void myDisplay(byte x, byte y, char str, float temp);

    Компилятор задумался (я успел обрадоваться), но, зараза :-), он снова поставил свой автограф :-)

    undefined reference to `myDisplay(unsigned char, unsigned char, char, float)

    На этот раз он пожаловался на строку вызова функции.

    Добавлено через 34 минуты
    Когда что-то новое затягивает, забываешь о нормальном отдыхе, теряешь концентрацию…
    Нашел ошибку. Чистейшая грамматика

    C++
    1
    
    void myDispay(byte x,...

    Dispay вместо Display

    Добавлено через 8 минут
    ValeryS, благодарю за попытку помощи!



    0



    ValeryS

    Модератор

    Эксперт по электронике

    8759 / 6549 / 887

    Регистрация: 14.02.2011

    Сообщений: 22,972

    15.09.2019, 10:36

    9

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    void myDisplay(byte, byte, char, float) = 0;

    вот так не надо делать(приравнивать функцию к нулю)
    так в классическом С++ объявляют чисто виртуальные функции, и класс в котором объявлена чисто виртуальная функция становится абстрактным. Означает что у функции нет реализации и в дочернем классе нужно обязательно реализовать функцию. А из абстрактного класса нельзя создать объект

    Добавлено через 5 минут

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    void myDispay(byte x, byte y, char str, float temp)

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    myDisplay(0, 0, «C», temp);

    просишь чтобы функция принимала символ char str, а передаешь строку "C"
    или передавай символ

    C++
    1
    
    myDisplay(0, 0, 'C', temp);

    или проси передавать строку, например так

    C++
    1
    
    void myDispay(byte x, byte y, char * str, float temp);



    1



    Avazart

    Эксперт С++

    8385 / 6147 / 615

    Регистрация: 10.12.2010

    Сообщений: 28,683

    Записей в блоге: 30

    15.09.2019, 12:02

    10

    Кроме того наверное лучше так:

    C++
    1
    2
    3
    4
    5
    6
    7
    8
    
    void myDispay(PCD8544& lcd,byte x, byte y, char str, float temp) 
    {
      lcd.setCursor(x, y);   // начиная с (x,y)...
      lcd.print(temp, 1);   // выводим temp
      lcd.print(str);   // выводим писанину
    }
     
    myDisplay(lcd,0, 0, 'C', temp);

    Тогда можно будет вынести ф-цию в отдельный файл/модуль.



    1



    locm

    15.09.2019, 21:07

    Не по теме:

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    Arduino Uno.

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    AVR (Basic, немного Assembler).

    Arduino Uno это AVR, для которого можете писать на бейсике или ассемблере.



    0



    Avazart

    15.09.2019, 21:21

    Не по теме:

    Цитата
    Сообщение от locm
    Посмотреть сообщение

    Arduino Uno это AVR, для которого можете писать на бейсике или ассемблере.

    Но лучше не надо …



    0



    Lavad

    0 / 0 / 0

    Регистрация: 03.10.2015

    Сообщений: 25

    16.09.2019, 12:12

    13

    Цитата
    Сообщение от ValeryS
    Посмотреть сообщение

    это где ж такое написано?
    функцию нужно объявить перед первым вызовом, сиречь сверху
    можно и просто декларировать сверху
    а объявить уже в удобном месте

    Оказалось, что я верно понял чтиво по справочникам: если ты вызываешь функцию, это и есть обьявление функции. А сама функция может располагаться по скетчу в ЛЮБОМ месте (но за пределами setup, loop и любых других функций). И больше никаких специфических строк.

    Цитата
    Сообщение от ValeryS
    Посмотреть сообщение

    вот так не надо делать(приравнивать функцию к нулю)…

    Методом проб и ошибок уже понял :-).

    Цитата
    Сообщение от ValeryS
    Посмотреть сообщение

    или передавай символ… 'C'

    Если передаю в одинарных кавычках

    более одного

    символа, а функция ждет как char str, то выводятся на экран только самый правый из отправленных символов. Отправил «абв», а выводится «в».
    Выкрутился, прописав в функции char str[], а символы отправляю через двойные кавычки.

    Цитата
    Сообщение от ValeryS
    Посмотреть сообщение

    или проси передавать строку, например так… char * str

    Буквально вчера попалось это в справочнике, но как-то не дошло, что тоже мой вариант :-).

    Цитата
    Сообщение от Avazart
    Посмотреть сообщение

    Кроме того наверное лучше так:

    C++
    1
    
    void myDispay(PCD8544& lcd,byte x, byte y, char str, float temp) {...}

    Тогда можно будет вынести ф-цию в отдельный файл/модуль.

    Благодарю за совет! Как-нибудь проверю…



    0



    Эксперт С++

    8385 / 6147 / 615

    Регистрация: 10.12.2010

    Сообщений: 28,683

    Записей в блоге: 30

    16.09.2019, 12:54

    14

    Цитата
    Сообщение от Lavad
    Посмотреть сообщение

    Оказалось, что я верно понял чтиво по справочникам: если ты вызываешь функцию, это и есть обьявление функции

    Нафиг выкиньте эти справочники.
    Почитайте мои ссылки.



    0



    0 / 0 / 0

    Регистрация: 03.10.2015

    Сообщений: 25

    16.09.2019, 13:00

    15

    Ссылки Ваши добавлены в закладки. Время от времени заглядываю.
    Но теория для меня — всего лишь набор понятий. Я же высказался после практической проверки. А как я понял, так оно и работает :-)



    0



    Error message 'dir1PinL' was not declared in this scope. keeps coming up. Any ideas?

    #include "Arduino.h"
    
    /*motor control*/
    void go_Advance(void)  //Forward
    {
      digitalWrite(dir1PinL, HIGH);
      digitalWrite(dir2PinL, LOW);
      digitalWrite(dir1PinR, HIGH);
      digitalWrite(dir2PinR, LOW);
    }
    
    void go_Left(void)  //Turn left
    {
      digitalWrite(dir1PinL, HIGH);
      digitalWrite(dir2PinL, LOW);
      digitalWrite(dir1PinR, LOW);
      digitalWrite(dir2PinR, HIGH);
    }
    
    void go_Right(void)  //Turn right
    {
      digitalWrite(dir1PinL, LOW);
      digitalWrite(dir2PinL, HIGH);
      digitalWrite(dir1PinR, HIGH);
      digitalWrite(dir2PinR, LOW);
    }
    
    void go_Back(void)  //Reverse
    {
      digitalWrite(dir1PinL, LOW);
      digitalWrite(dir2PinL, HIGH);
      digitalWrite(dir1PinR, LOW);
      digitalWrite(dir2PinR, HIGH);
    }
    
    void stop_Stop()    //Stop
    {
      digitalWrite(dir1PinL, LOW);
      digitalWrite(dir2PinL, LOW);
      digitalWrite(dir1PinR, LOW);
      digitalWrite(dir2PinR, LOW);
    }
    
    /*set motor speed */
    void set_Motorspeed(int speed_L, int speed_R)
    {
      analogWrite(speedPinL, speed_L);
      analogWrite(speedPinR, speed_R);
    }
    
    //Pins initialize
    void init_GPIO()
    {
      pinMode(dir1PinL, OUTPUT);
      pinMode(dir2PinL, OUTPUT);
      pinMode(speedPinL, OUTPUT);
    
      pinMode(dir1PinR, OUTPUT);
      pinMode(dir2PinR, OUTPUT);
      pinMode(speedPinR, OUTPUT);
      stop_Stop();
    }
    
    void setup()
    {
      init_GPIO();
      go_Advance();//Forward
      set_Motorspeed(255, 255);
      delay(5000);
    
      go_Back();//Reverse
      set_Motorspeed(255, 255);
      delay(5000);
    
      go_Left();//Turn left
      set_Motorspeed(255, 255);
      delay(5000);
    
      go_Right();//Turn right
      set_Motorspeed(255, 255);
      delay(5000);
    
      stop_Stop();//Stop
    }
    
    void loop()
    {
    }
    

    This is the entire error message:

    Arduino: 1.8.6 (Windows 10), Board: "Arduino/Genuino Uno"
    
    C:UsersWilliamDocumentssmartcar-lesson1smartcar-lesson1.ino: In function 'void go_Advance()':
    
    smartcar-lesson1:20:16: error: 'dir1PinL' was not declared in this scope
    
       digitalWrite(dir1PinL, HIGH);
    
                    ^
    
    smartcar-lesson1:21:16: error: 'dir2PinL' was not declared in this scope
    
       digitalWrite(dir2PinL,LOW);
    
                    ^
    
    smartcar-lesson1:22:16: error: 'dir1PinR' was not declared in this scope
    
       digitalWrite(dir1PinR,HIGH);
    
                    ^
    
    smartcar-lesson1:23:16: error: 'dir2PinR' was not declared in this scope
    
       digitalWrite(dir2PinR,LOW);
    
                    ^
    
    C:UsersWilliamDocumentssmartcar-lesson1smartcar-lesson1.ino: In function 'void go_Left()':
    
    smartcar-lesson1:27:16: error: 'dir1PinL' was not declared in this scope
    
       digitalWrite(dir1PinL, HIGH);
    
                    ^
    
    smartcar-lesson1:28:16: error: 'dir2PinL' was not declared in this scope
    
       digitalWrite(dir2PinL,LOW);
    
                    ^
    
    smartcar-lesson1:29:16: error: 'dir1PinR' was not declared in this scope
    
       digitalWrite(dir1PinR,LOW);
    
                    ^
    
    smartcar-lesson1:30:16: error: 'dir2PinR' was not declared in this scope
    
       digitalWrite(dir2PinR,HIGH);
    
                    ^
    
    C:UsersWilliamDocumentssmartcar-lesson1smartcar-lesson1.ino: In function 'void go_Right()':
    
    smartcar-lesson1:34:16: error: 'dir1PinL' was not declared in this scope
    
       digitalWrite(dir1PinL, LOW);
    
                    ^
    
    smartcar-lesson1:35:16: error: 'dir2PinL' was not declared in this scope
    
       digitalWrite(dir2PinL,HIGH);
    
                    ^
    
    smartcar-lesson1:36:16: error: 'dir1PinR' was not declared in this scope
    
       digitalWrite(dir1PinR,HIGH);
    
                    ^
    
    smartcar-lesson1:37:16: error: 'dir2PinR' was not declared in this scope
    
       digitalWrite(dir2PinR,LOW);
    
                    ^
    
    C:UsersWilliamDocumentssmartcar-lesson1smartcar-lesson1.ino: In function 'void go_Back()':
    
    smartcar-lesson1:41:16: error: 'dir1PinL' was not declared in this scope
    
       digitalWrite(dir1PinL, LOW);
    
                    ^
    
    smartcar-lesson1:42:16: error: 'dir2PinL' was not declared in this scope
    
       digitalWrite(dir2PinL,HIGH);
    
                    ^
    
    smartcar-lesson1:43:16: error: 'dir1PinR' was not declared in this scope
    
       digitalWrite(dir1PinR,LOW);
    
                    ^
    
    smartcar-lesson1:44:16: error: 'dir2PinR' was not declared in this scope
    
       digitalWrite(dir2PinR,HIGH);
    
                    ^
    
    C:UsersWilliamDocumentssmartcar-lesson1smartcar-lesson1.ino: In function 'void stop_Stop()':
    
    smartcar-lesson1:48:16: error: 'dir1PinL' was not declared in this scope
    
       digitalWrite(dir1PinL, LOW);
    
                    ^
    
    smartcar-lesson1:49:16: error: 'dir2PinL' was not declared in this scope
    
       digitalWrite(dir2PinL,LOW);
    
                    ^
    
    smartcar-lesson1:50:16: error: 'dir1PinR' was not declared in this scope
    
       digitalWrite(dir1PinR,LOW);
    
                    ^
    
    smartcar-lesson1:51:16: error: 'dir2PinR' was not declared in this scope
    
       digitalWrite(dir2PinR,LOW);
    
                    ^
    
    C:UsersWilliamDocumentssmartcar-lesson1smartcar-lesson1.ino: In function 'void set_Motorspeed(int, int)':
    
    smartcar-lesson1:57:15: error: 'speedPinL' was not declared in this scope
    
       analogWrite(speedPinL,speed_L); 
    
                   ^
    
    smartcar-lesson1:58:15: error: 'speedPinR' was not declared in this scope
    
       analogWrite(speedPinR,speed_R);   
    
                   ^
    
    C:UsersWilliamDocumentssmartcar-lesson1smartcar-lesson1.ino: In function 'void init_GPIO()':
    
    smartcar-lesson1:64:10: error: 'dir1PinL' was not declared in this scope
    
      pinMode(dir1PinL, OUTPUT); 
    
              ^
    
    smartcar-lesson1:65:10: error: 'dir2PinL' was not declared in this scope
    
      pinMode(dir2PinL, OUTPUT); 
    
              ^
    
    smartcar-lesson1:66:10: error: 'speedPinL' was not declared in this scope
    
      pinMode(speedPinL, OUTPUT);  
    
              ^
    
    smartcar-lesson1:68:10: error: 'dir1PinR' was not declared in this scope
    
      pinMode(dir1PinR, OUTPUT);
    
              ^
    
    smartcar-lesson1:69:11: error: 'dir2PinR' was not declared in this scope
    
       pinMode(dir2PinR, OUTPUT); 
    
               ^
    
    smartcar-lesson1:70:11: error: 'speedPinR' was not declared in this scope
    
       pinMode(speedPinR, OUTPUT); 
    
               ^
    
    exit status 1
    'dir1PinL' was not declared in this scope
    
    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.
    

    Понравилась статья? Поделить с друзьями:

    Читайте также:

  • Error cloning repository check log for details
  • Error clock watchdog timeout
  • Error cin is not a member of std
  • Error cin does not name a type
  • Error choosepixelformat failed

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии