Arduino complie ./xxx.h: No such file or directory - arduino

I'm new to arduino, I'm supposed to add tinyGPS.h but locally, but where is "locally"
line of code:
#include "./TinyGPS.h" // Use local version of this library
I've tried copy and pasting the tinygps.h in whatever arduino folder I could under the belief ./ is in the root of the working directory.
I expected the code to compile.

It means in the same directory as the source file in which you wrote #include.

Related

Changing path in JVM options Launch4j isn't working

for some reason when i use the full path for the sdk lib the application runs..
--module-path="D:\tools\javafx-sdk-18.0.1\lib" --add-modules=javafx.controls,javafx.fxml,javafx.media
but since i want the application to run on other computers, i copied the lib file which contains javafx.media...etc to the application folder and tried to put the path to it as "lib"..
since it's in the same folder of the exe. but it didn't work..
i tried then to put the full path for the lib which is in the application folder and still it didn't work even tho I provided the whole path..
but when I reput the path "D:\tools\javafx-sdk-18.0.1\lib" it works again..
it feels like my application don't love other paths, he only works with this :(
what should i do ?
I've had much success compiling OS-specific, self-contained runnable programs using this JavaPackager library. It takes a lot of the 'grunt work' out of creating distributable programs from Java.
I solved this problem..
first i needed to copy the whole folder of javafx18.0..etc
not only the lib folder...2ndly when writting the path in Launch4j you must write it like this "../yoururl/" to make the path relative to the app folder...
3rdly i copied all my code and files to NetBeans in Maven project and build it using jlink...i created the runnable jar using eclipse and i converted the jar to exe then put it in the output folder of jlink build including the javafx18..etc
and it worked fine now my app works on all computers...thanks to Slaw who commented. i figured jlink by his help.

Trying to use the NFC Shield by Seeed-Studio PN532 library on Arduino

I bought this NFC Shield for my Arduino controller.
https://www.reichelt.de/arduino-shield-nfc-v2-pn532-ard-shd-nfc-v2-p191287.html?PROVID=2788&gclid=Cj0KCQjwnv71BRCOARIsAIkxW9HRIoBqh_ij1c8Kgh8S5l-aCqeCL1c67U8G7OStFVa8SAnW_ZD3V0saAtJxEALw_wcB&&r=1
https://www.seeedstudio.com/NFC-Shield-V2-0.html?utm_source=blog&utm_medium=blog
I downloaded and installed this library as instructed from GitHub
https://github.com/Seeed-Studio/PN532
But when I include the library I get an error:
Code:
include "PN532_SPI.h"
Error message:
ResolveLibrary(PN532/PN532/PN532Interface.h)
In file included from D:\OneDrive\Ardruino\NFC Reader\Seeed\Example Code\2020-05-14\2020-05-14.ino:1:0:
-> candidates: []
C:\Program Files (x86)\Arduino\libraries\PN532_SPI/PN532_SPI.h:6:10: fatal error: PN532/PN532/PN532Interface.h: No such file or directory
include "PN532/PN532/PN532Interface.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
What could be the problem? Please help?
I managed to fix it.
One has to open each and every file in the library and remove the path PN532/PN532_SPI/
So just the file name included must remain, with no path.
So all the .cpp and .h files
Open all .cpp and all .h files in the library and edit them...
Notepad does not format the files correctly, I had to use Visual Studio to edit the .h and .cpp files.

Include local library

I'm trying to copy a couple of libraries I created to my local sketch folder, as instructed in the Arduino Library Tutorial
My folder structure is the following
Documents\Arduino\MySketch\
MySketch.ino
libraries\
Timer\
Timer.h
Timer.cpp
I get the following error
fatal error: Timer.h: No such file or directory
#include <Timer.h>
Note that this works just fine if I move my libraries to the C:\Program Files (x86)\Arduino\libraries folder, but I really don't want to keep them appart from my source since I can not check them to my git repository.
I think I'm following the instructions given in the tutorial precisely. I just googled about this and found several similar problems, but no solution. It's supposed to be working in recent versions of the IDE (I'm on 1.8.5 on Windows 10).
I also tried to include the libraries using double quotes instead of angle brackets but I got the same error.
Can you please let me know how to fix this problem?
Thanks
Recent versions of the Arduino IDE do recursive compilation of the src subfolder of the sketch folder. So to achieve your goal, you will want a folder structure that looks something like this:
MySketch
|_MySketch.ino
|_src
|_Timer
|_Timer.h
|_Timer.cpp
Then the #include directive in the sketch should look like this:
#include "src/Timer/Timer.h"
It's quite common for Arduino libraries to use incorrect syntax for their internal #include directives. For example, Timer.cpp might contain this line:
#include <Timer.h>
That doesn't cause a problem when the library is installed normally but it will cause an error when you try to use the library bundled with a sketch. The solution is to edit the library to use the correct syntax:
#include "Timer.h"
It seems to me that the solution looks fine if libraries/Timer is used only by this sketch. What if you have several projects {git_repo}/sketch_{n}/sketch_{n}.ino calling the same class Timer(.h, .cpp) ?
If you want to avoid code duplication (and you do), then you may put them into {git_repo}/libraries/. You will still be able to check them out into git. However, this is painful because it requires that each time you modify one file into the library, you need to :
delete the dir C:\Program Files (x86)\Arduino\libraries\Timer
reload the ".zip" (from {git_repo}/libraries/Timer) from the Arduino IDE
Very painful.
What you could do is create a symbolic link from {git_repo}/libraries/your_library to C:\Program Files (x86)\Arduino\libraries\your_library
On Ubuntu that would be :
cd ~/Arduino/libraries/ # where Arduino stores the libs
rm -rf Timer/ # deleting your library if exists
ln -s ~/dev/code/[MY_PROJECT]/libraries/Utils/Timer Timer
The Arduino IDE will know your library exists, and would recompile it automatically if Timer.{h,cpp} (from your git_repo) was modified in between.

Qt Error: cannot open include file: 'opencv2/core/core.hpp' no such file or directory

I want to build an opencv project using Qt 5.1_VS2010. I have included the path for opencv include files. But when I run the code, I get the error that specific .hpp file does not exist! I have checked in the directory and it actually exists there! another point that when I was trying to include it in my main c++ file, the auto completion guide actually helped me complete the whole path! so it means the directory and the header file was already recognized! anyway, part of my .pro file that includes the path is like this:
INCLUDEPATH += "C:/opencv/build/include"

How to compile a sketch using Arduino

I have a custom board that uses ATmega168PV, and I have a bin file that when I use Atmel Studio 6.0, I can program it to my board.
I have the source code for the binary (in the format of sketch), and I want to change/compile the code and program the board with them.
I can open my *.ino file in Arduino IDE and it is verifying it and says that
Binary sketch size: 12,096 bytes (of a 32,256 byte maximum)
but I searched the folder that files exist and I could not find any binary file.
How can I compile the code using Arduino IDE?
Build process
Sketches are compiled by avr-gcc.
The include path includes the sketch's directory, the target directory (/hardware/core//) and the avr include directory (/hardware/tools/avr/avr/include/), as well as any library directories (in /hardware/libraries/) which contain a header file which is included by the main sketch file.
When you verify a sketch, it is built in a temporary directory in the system temp directory (e.g. /tmp on the Mac). When you upload it, it is built in the applet/ subdirectory of the sketch's directory (which you can access with the "Show Sketch Folder" item in the "Sketch" menu).
The .c and .cpp files of the target are compiled and output with .o extensions to this directory, as is the main sketch file and any other .c or .cpp files in the sketch and any .c or .cpp files in any libraries which are #included in the sketch.
These .o files are then linked together into a static library and the main sketch file is linked against this library. Only the parts of the library needed for your sketch are included in the final .hex file, reducing the size of most sketches.
The .hex file is the final output of the compilation which is then uploaded to the board. During a "Verify" the .hex file is written to /tmp (on Mac and Linux) or \Documents and Settings\\Local Settings\Temp (on Windows). During upload, it's written to the applet sub-directory of the sketch directory (which you can open with the "Show Sketch Folder" item in the Sketch menu).
Do a file search in your temp folder for *.cpp.hex

Resources