Arduino: Error: 'PubNub' was not declared in this scope - c

I'm new to Arduino. When Arduino verifies this sketch https://github.com/MediaTek-Labs/Real-Time-Bicycle-Tracking-Map-using-PubNub throws the following:
Build options changed, rebuilding all
BikeTracker.ino: In function 'void setup()':
BikeTracker.ino:45:5: error: 'PubNub' was not declared in this scope
BikeTracker.ino: In function 'void loop()':
BikeTracker.ino:91:14: error: 'PubNub' was not declared in this scope
I've read most answers are pointing out to https://www.arduino.cc/en/Guide/Libraries some people say it's common Arduino linking issue (easy to fix) after tried out multiple approaches with no dice.
I've also followed PubNub customer support advice (with list of steps below) but no avail:
I got this from our hardware/IoT/embedded engineer:
You are probably not including all the libraries, or has the wrong
path for them.
When you download the source at
MediaTek-Labs/Real-Time-Bicycle-Tracking-Map-using-PubNub on GitHub:
Click .ino file and a pop up will ask if you need a new folder for the
sketch – click Yes.
Then copy the rest of the files from the source to
this new folder.
Compile it and see if you get any library path errors
that you need to provide. Let me know if you require further
assistance.
BTW this is my PubNub.h. Hope someone can shed some lights.

It turns out my Arduino IDE could not find PubNub.* files until I manually added them as Library.

Related

Redefinition + Conflicting types errors, but nothing is being redefined or actually conflicting

I am getting some errors I'm not really understanding, nor a solution to get around them.
I am working on a ESP32 Bluetooth connection using esp-IDF, VSCode, and PlatformIO.
I have a section of code
esp_hid_gap_init(ESP_BT_MODE_BTDM);
esp_ble_gattc_register_callback(esp_hidh_gattc_event_handler);
esp_hidh_config_t config = {
.callback = hidh_callback,
};
ESP_ERROR_CHECK( esp_hidh_init(&config) );
btkeyboard_queue_init();
ESP_ERROR_CHECK( err );
That is initialising Bluetooth and looking for connections, it requires the use of a header called bluetoothkeyboard.h which i pulled from: https://github.com/bozont/Duke3D/tree/master/components/SDL/bluetoothkeyboard
When i include this header in my main.c i get 11 errors, 10 from bluetoothkeyboard.h and one from SDL_event.h (also in the github repo i linked) they are:
The code is all unmodified and it clearly works in his demo and many others who have used it and I'm not keen on messing with a third-party library, I just don't understand what's going on and how to move around it.
Earlier it was compiling but I was getting a Collect2.exe: error: ld returned 1 exit status. To get around it I tried moving the section above into my main.c just to check but ended up in this world of pain.
I get the messages are telling me I am redefining a function, but you use the right click find all and it just references itself so I'm at a loss.
EDIT
Here is an example of one of the compiler errors:
And my CMAKE file
cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(TTGODemo)
EDIT2**
Ok so taking the comments on board, I removed the second include of BTKeyboard out of the ESP_HID_GAP.H i had. I had put it in there to cover a static constant char that was declared in only bluetoothkeyboard.h so idk how they were communicating.
That was done, I got the following wall of Text:
I think there are functions in the Bluetooth libraries that are also in the esp_hid_gap.h that it's getting hung up on. But i don't really know what to do about it, i could try removing the BT libraries but that will probably make things worse.
Thoughts?

I cant use auxiliary functions from zephyr ( tty.h) file

I am building a project and I have the board stm nucleo_l496zg. All i want to do is to use the drivers from the board in order to communicate the board after west flash with minicom, it is a simple string transfer and response program. I am building this project with zephyr and my issue is that I cant use the functions tty_init , tty_read and tty_set_rx_buf despite that I use the proper include " #include <console/tty.h> ". The compiler returns an undefined reference to thoose three functions but in my program I am using another one function from tty.h header which is tty_set_timeout but at this function it doesnt say nothing. Though I notiched in that in here(documentation of tty.h) tty_Set_timeout is the only function that has something inside. I cant understand why I am getting that please if someone can help me let me know !
I had the same problem and I solve it by adding those lines to my .conf file:
CONFIG_SERIAL=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_CONSOLE_SUBSYS=y
CONFIG_CONSOLE_GETCHAR=y
And don't forget to mention the file (.conf file) also in your CMakeList.txt file:
set(CONF_FILE ***.conf)
Hope that it will work with you as well

What is the appropriate (easiest) way to connect driver vers 3.0.17 to Android Async activity

The logic should be correct for the actual Query but I keep getting the following error:
05-02 00:27:39.709 12213-12753/com.example.jordan.myapplication E/error here 3 :: Invalid name: libs/mysql-connector-java-3.0.17-ga-bin.jar
I did, at the time receiving the above in logcat, have the drier included in libs but as a module. I had previously to the error, at one point, have it set in libs but I had since taken it out. I must have left something in their. However, my gradle dependencies were set to include it as a module:
compile project('mysql-connector-java-3.0.17-ga-bin.jar')
i have since the error added the driver to the library, deleted the module and reset my dependence as:
compile files('libs/mysql-connector-java-3.0.17-ga-bin.jar')
Computer has frozen. Restarting computer and then testing...
I was forgetting a : at the beginning of 'mysql-connctor-java-3.0.17-ga-bin.jar' Still not able to get information through the queries I wrote, however, this solves the technical question.

Biometric matching with futronic sdk using nodejs server

I have successfully taken bio-metric prints and posted to the node server using the futronic sdk. I want to be able to use this library likewise for matching in the server because that's where the bio-metric prints for all users are stored. I stubbled upon the node-ffi library that helps define equivalent C functions that I have exported and compiled it down to a .dll file.
Now the challenge here is that I have tried to port the ftrAnsiSDK functions but the ftrScanAPI.dll and the ftrAnsiSDK.dll file could not be compiled together. It gives this error:
...collect2.exe [Error] ld returned 5 exit status
When I compile and export the functions that are not dependent on these two libraries, my code works fine and the functions are easily exported and used in the node server. Please can any one give me a hint?
Here is the link to the repo. It consists of the lib and .dll library that is been used.
For the server code here is a snippet of what I am trying to achieve:
var libm = ffi.Library('lib/visystem', {
'HelloWorld': [ 'void', [] ],
'PrintErrorMessage': [ 'void', ['int'] ],
'CaprureImage': [ 'int', ['int','int','int'] ]});
The HelloWord and PrintErrorMessages are methods that I used as a test case to ensure the functions are being exported before I proceeded to the main functions (you can see the function definition in from the code in the repo.. ) that depends on the futronic lin and sdk.
I am currently using a 64-bit operation system and I installed the same program on a 32-bit machine to be sure, but it still did not compile and export the function. The code editor I am using is Dev++C.
Can anyone help or even give me hint on how to achieve this goal?
As a disclaimer, I'm not familiar with the Dev-C++ IDE or MinGW development.
However, after a cursory look at your github repo, according to your libvisystem.def file, it appears that the only functions that are exported by your DLL are:
HelloWorld
PrintErrorMessage
ReadTemplateFile
SaveBmpFile
SaveTemplateFile
This is also confirmed when looking at the libvisystem.a library header:
So you should probably start by manually add the rest of the exported functions in your dll.h to the def file, in a similar manner to the ones that are already there, and see if that changes anything.
NOTE:
I'm not sure whether the __declspec(dllexport) directive is ignored by the Dev-C++ compiler/linker and it uses the def file instead. Perhaps others on SO have an idea.

Lua loadfile not finding a file

I had some lua code with the following line:
JSON = loadfile("JSON.lua")()
The file JSON.lua is in the same directory as the lua code that line came from. This code worked for me for a while, and then, without my changing either the lua source, or the JSON.lua, or permission of any of the files, or the directory from where I was running the lua code, I started getting a nil error on that line. (I simply recall NO relevant changes that could have any impact on the lua code.)
Adding an assert revealed that the error was caused by the file not being found. Playing with file permissions, restarting my machine didn't resolve the issue, and pulling back code that I had checked in and was working perfectly did not resolve the error.
I resolved the error by changing the line above to provide the absolute path to that JSON.lua file.
Is there anything explaining why the code without the absolute path could have worked for a while and then stopped working?
Note: This behavior of working and then not working happened to me twice over a week. I am puzzled and though I have now found a fix, I am really curious as to the explanation for that intermittent behavior.
Lua uses package.path, whose default value comes from the environment variable LUA_PATH if it is set, as the list of directories to search. You can put . of the front of this list to load files from the current directory, or you can put your files in a path on the list.
A late answer on this, as I found exactly the same problem.
First, contrary to the previous answer, loadfile doesn't use the package.path search path. It only looks in the specified directory. And if you don't specify a directory, it only look in the 'current directory'. I can't explain exactly why it stopped working for you, but probably your Lua code is somehow being run with a different 'current directory' than previous.
There are two possible fixes: One is to specify an absolute path to loadfile.
JSON = loadfile("c:\\my_folder\\JSON.lua")()
The alternative fix depends on the particular library you're using, which I suspect is Jeffrey Friedl's Lua JSON lilbrary. Because this supports the newer Lua module mechanism, you can just load the module with require, which does support the package.path search path.
JSON = require("JSON")

Resources