Can't include <I2S.h> on ESP32 on neither VSCode PIO nor Arduino IDE - visual-studio-code

I've tried to get my ESP32 LOLIN32 with Arduino framework working, but I can't even upload code to it. I'm including nothing but Arduino and I2S but it doesn't understand what I mean with I2S.
I have only written:
#include <I2S.h>
#include <Arduino.h>
void setup(){
}
void loop(){
}
but it fails to compile and gives:
src\main.cpp:1:17: fatal error: I2S.h: No such file or directory
*************************************************************
* Looking for I2S.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:I2S.h"
* Web > https://registry.platformio.org/search?q=header:I2S.h
*
*************************************************************
Arduino IDE can't find it eather, I get the same error.
I've tried adding build_flags = -I and lib_deps in platform.ini:
[env:lolin32]
platform = espressif32
board = lolin32
framework = arduino
build_flags = -I include
lib_deps =
I2S
to no avail.

I2S.h was added to arduino-esp32 from version 2.0.3-RC1.
The OP does not describe the used version, but I guess it is older than the mentioned 2.0.3
I suggest updating arduino-esp32

Related

G_DECLARE_FINAL_TYPE() throws compiler error

I have written a programm in C and GTK3. I am using Arch Linux and everything works fine. However, I have to use my program also on a rather old Ubuntu machine.
gtk+-3.0 3.10.8
GCC 4.8.4
With this setup the program does not compile
In the Header file of a custom GTK-Widget I have:
#ifndef __LAYER_ELEMENT_H__
#define __LAYER_ELEMENT_H__
#include <gtk/gtk.h>
G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE(LayerElement, layer_element, LAYER, ELEMENT, GtkListBoxRow)
/* Rest of file comes here */
When compiling it throws the error message:
expected ')' before GtkListBoxRow in the line with the G_DECLARE_FINAL_TYPE macro.
How can I fix this issue?
G_DECLARE_FINAL_TYPE was added to GLib in version 2.44 (see the documentation). If you want to compile on an old version of Ubuntu, you will either have to get hold of a backport of GLib 2.44 (or later) for that version of Ubuntu, and compile against that; or you will have to modify your code to not use any GLib APIs added after version 2.40.

Arduino Linux mint: error: ‘digitalPinToInterrupt’

I wanted to interrupt a simple squared voltage and I was using a common program:
const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, CHANGE);
}
void loop() {
digitalWrite(ledPin, state);
}
void blink() {
state = !state;
}
But if I want to verify it with the Arduino Software, this is the error:
interrupt.ino: In function ‘void setup()’:
interrupt.ino:11:53: error: ‘digitalPinToInterrupt’ was not declared in this scope
I already tried adding libraries, which include this command, but I had problems finding them.
I am using Linux mint and the Arduino software version is:
arduino:
Installed: 2:1.0.5+dfsg2-4
Candidate: 2:1.0.5+dfsg2-4
Version table:
*** 2:1.0.5+dfsg2-4 500
And I couldn't install the IDE which I downloaded from https://www.arduino.cc
So this is the version of the package manager in Linux mint.
My question now is, does someone know where to find the libary which includes digitalPinToInterrupt().
There is no libary manager in this version of IDE, so perhaps someone knows how to get a newer version of IDE for Linuxmint.
Thank you
SOLVED
The version 1.8.2 for Linux 64bit on https://www.arduino.cc/en/Main/Software is defective. I found an other one on http://www.arduino.org/downloads.
This version also already includes digitalPinToInterrupt().

Eclipse Path to Include Directories not working for me (Windows 7-64, C++)

I installed GCC (4.8.1) this morning and Eclipse Kepler (SR2). My Hello World compiled and ran fine, so I'm moving toward my goal of writing a C++ app using Boost. I installed Boost to "C:\Program Files\boost\boost_1_55_0" and added this path to Project>Properties>C/C++ General>Paths and Symols>[tab]Includes>GNU C++. However, when I compile, the path isn't showing up in the g++ command line, so understandably, the header file isn't getting found.
15:55:24 **** Incremental Build of configuration Debug for project BoostApp ****
Info: Internal Builder is used for build
g++ -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\BoostApp.o" "..\\src\\BoostApp.cpp"
..\src\BoostApp.cpp:1:32: fatal error: boost/filesystem.hpp: No such file or directory
#include "boost/filesystem.hpp"
^
compilation terminated.
15:55:24 Build Finished (took 78ms)
I realize this is a newb question and spent a few hours searching around and finding mostly direction to set the path, which I've done. I've checked the install and the header file is there. I've also done my own command line compile adding "-I C:\Program Files\boost\boost_1_55_0" to the command line and GCC found the header file fine.
Not sure where I'm going wrong. As mentioned, it's a new install of GCC, Eclipse, and Boost, so maybe I went wrong somewhere during the install or maybe creating the project? Or just a newb question? Below is the app I'm compiling which I copied from rosettacode.com
#include "boost/filesystem.hpp"
#include "boost/regex.hpp"
#include <iostream>
using namespace boost::filesystem;
int main()
{
path current_dir("."); //
boost::regex pattern("a.*"); // list all files starting with a
for (recursive_directory_iterator iter(current_dir), end;
iter != end;
++iter)
{
std::string name = iter->path().filename().string();
if (regex_match(name, pattern))
std::cout << iter->path() << "\n";
}
}

Opencv2.4.0 with mingw in windows get crashed

I followed steps in this SO link to compile a sample program using OpenCV2.4.0 in windows. I made a setup both in DEVC++ and NetBeans with Mingw. My sample Program is getting Compiled properly, but when I run the exe the application get crashes.
But In same machine I used opencv2.1.0 and the same sample program gets compiled and there is no crash while running it.
The below is the Sample Code I tried to execute:
#include "highgui.h"
using namespace std;
int main( int argc, char** argv ) {
IplImage* img = cvLoadImage( "C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg" );
cvNamedWindow( "Sample", CV_WINDOW_AUTOSIZE );
cvShowImage( "Sample", img );
cvWaitKey(0);
cvReleaseImage( &img );
cvDestroyWindow( "Sample" );
}
UPDATE :
I follwed as the steps as moskito-x link to build the opencv and when I press "configure", I get the following error. And my make file is also 35kb in size.
Any suggestions to solve this?
Using the libs in "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib
You can not use the libraries that come with OpenCV-2.4.x.exe.
As some developers in forums and I find out. On some systems, the precompiled libs of "opencv 2.4.x" can not be used.
To compile your own programs, works, but it crashed if you try to run them. Until there are not functioning precompiled libs of "opencv 2.4.x , you have to compile opencv yourself.
Ignore so the folder "...\opencv\build\x86\mingw\bin" and "...\opencv\build\x86\mingw\lib" completely.
As already pointed out you can't rely on precompiled binaries. I also had a lot of problems and finally ended up with compiling my own binaries. My setup was for Windows7, Eclipse CDT (Juno) and MinGW. You can check my post on Stackoverflow here
I guess this is an error related to memory management. Maybe because your'e releasing the window before the image. But anyhow you should use the OpenCV C++ interface, as this does a lot of stuff automagically. With the C++ Interface your code would look like this:
#include <opencv.hpp>
int main( int argc, char** argv ) {
cv::Mat img = cv::imread("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Water lilies.jpg");
cv::imshow("Sample", img);
cv::waitKey(0);
return 0
}

compiler errors using Boost.Python with macports Python.framework

This might be a very dumb question...
I'm trying to use Boost.Python in an Xcode project (boost 1.50, xcode 4.4, OS X 10.8). I installed both boost and python through macports. I dragged the macports Python framework (/opt/local/Library/Frameworks/Python.framework) into the project and tried the most minimal program possible:
#include <boost/python.hpp>
int main(int argc, const char * argv[]) {
Py_Initialize();
Py_Finalize();
return 0;
}
and get:
/opt/local/include/boost/python/detail/wrap_python.hpp:50:11: fatal error: 'pyconfig.h' file not found
Do I need to explicitly add the framework header folder to the project's header search paths? That seems irregular... so hopefully I'm just misunderstanding something?