Hi,
I am trying to use SPI bus on Raspberry wit Qt framework but without 3rd party libraries.
I have tried to implement simple loopback test (https://www.raspberrypi.org/document.../spi/README.md) but I have got following errors:
/usr/include/c++/6/bits/stl_algo.h:59: In file included from /usr/include/c++/6/bits/stl_algo.h:59:0,
/usr/include/c++/6/algorithm:62: from /usr/include/c++/6/algorithm:62,
/usr/include/arm-linux-gnueabihf/qt5/QtCore/qglobal.h:94: from /usr/include/arm-linux-gnueabihf/qt5/QtCore/qglobal.h:94,
/usr/include/arm-linux-gnueabihf/qt5/QtGui/qwindowdefs.h:43: from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qwindowdefs.h:43,
/usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qwidget.h:43: from /usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qwidget.h:43,
/usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qmainwindow.h:43: from /usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qmainwindow.h:43,
/usr
/include
/arm
-linux
-gnueabihf
/qt5
/QtWidgets
/QMainWindow:1: from
/usr
/include
/arm
-linux
-gnueabihf
/qt5
/QtWidgets
/QMainWindow:1,
/home/pi/MyAppFolder/application/MyApp/mainwindow.h:14: from ../MyApp/mainwindow.h:14,
/home/pi/MyAppFolder/application/MyApp/main.cpp:1: from ../MyApp/main.cpp:1:
/usr/include/c++/6/cstdlib:75: error: stdlib.h: No such file or directory
#include_next <stdlib.h>
/usr/include/c++/6/bits/stl_algo.h:59: In file included from /usr/include/c++/6/bits/stl_algo.h:59:0,
/usr/include/c++/6/algorithm:62: from /usr/include/c++/6/algorithm:62,
/usr/include/arm-linux-gnueabihf/qt5/QtCore/qglobal.h:94: from /usr/include/arm-linux-gnueabihf/qt5/QtCore/qglobal.h:94,
/usr/include/arm-linux-gnueabihf/qt5/QtGui/qwindowdefs.h:43: from /usr/include/arm-linux-gnueabihf/qt5/QtGui/qwindowdefs.h:43,
/usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qwidget.h:43: from /usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qwidget.h:43,
/usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qmainwindow.h:43: from /usr/include/arm-linux-gnueabihf/qt5/QtWidgets/qmainwindow.h:43,
/usr/include/arm-linux-gnueabihf/qt5/QtWidgets/QMainWindow:1: from /usr/include/arm-linux-gnueabihf/qt5/QtWidgets/QMainWindow:1,
/home/pi/MyAppFolder/application/MyApp/mainwindow.h:14: from ../MyApp/mainwindow.h:14,
/home/pi/MyAppFolder/application/MyApp/main.cpp:1: from ../MyApp/main.cpp:1:
/usr/include/c++/6/cstdlib:75: error: stdlib.h: No such file or directory
#include_next <stdlib.h>
To copy to clipboard, switch view to plain text mode
My .pro file is:
#-------------------------------------------------
#
# Project created by QtCreator 2018-06-13T08:59:05
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MyApp
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\
mainwindow.cpp \
cbc.cpp \
spi.cpp
HEADERS += mainwindow.h \
cbc.h
FORMS += mainwindow.ui
#LIBS+=-L/usr/local/lib -lwiringPi
INCLUDEPATH+=/usr/include
#-------------------------------------------------
#
# Project created by QtCreator 2018-06-13T08:59:05
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = MyApp
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += main.cpp\
mainwindow.cpp \
cbc.cpp \
spi.cpp
HEADERS += mainwindow.h \
cbc.h
FORMS += mainwindow.ui
#LIBS+=-L/usr/local/lib -lwiringPi
INCLUDEPATH+=/usr/include
To copy to clipboard, switch view to plain text mode
My includes are:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <linux/ioctl.h> //in spidev_test it is <sys/ioctl.h> but i don't have this header in sys folfder
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include <QMainWindow>
#include "qmessagebox.h"
#include "qstorageinfo.h"
#include "qstring.h"
#include "qtextstream.h"
//#include </root/wiringPi/wiringPi/wiringPiSPI.h>
//#include </root/wiringPi/wiringPi/wiringPi.h>
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <stdint.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#include <fcntl.h>
#include <linux/ioctl.h> //in spidev_test it is <sys/ioctl.h> but i don't have this header in sys folfder
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include <QMainWindow>
#include "qmessagebox.h"
#include "qstorageinfo.h"
#include "qstring.h"
#include "qtextstream.h"
//#include </root/wiringPi/wiringPi/wiringPiSPI.h>
//#include </root/wiringPi/wiringPi/wiringPi.h>
To copy to clipboard, switch view to plain text mode
If I remove INCLUDEPATH+=/usr/include from .pro file then include files can not be located.
Can someone help me with this error.
P.S. Another solution to this problem can be example of usage of wiringPiSPI for spidev1.0
Thanks in advance!
Bookmarks