How do I access USB with Electron? - c++

My systemenvironment: Windows 10 with Visual Studio 2015 (including C++ Compiler Tools) and node.js installed
I tried to include a node library into the electon-quick-start-project and failed.
First of all I tried electron-usb to include electron-usb. You can found my problem here. Unfortunately I couldn't solve it.
Therefore I tried to include usb. I found help how to do this here
I did every step according to this description:
npm install --save usb
changing the variables property in the node_modules/usb/binding.gyp to include module_name and module_path
electron-gyp node-gyp rebuild --target=0.26.0 --arch=ia32 --dist-url=https://atom.io/download/atom-shell
When I executed the rebuild command, I got a build error: error C2011: 'timespec': 'struct' type redefinition (compiling source file ..\libusb\libusb\core.c). Always the same error in different files.
I included HAVE_STRUCT_TIMESPEC in the project-files. But it didn't work either afterwards.
Now I ask myself, what is the easiest and best way to access USB with Electron? Which library can you recommend? Do you know any complete tutorial to include this library into electron?

if you have VS2015 installed on a windows 10 PC you shouldn't have to compile the source to electron-usb. just npm install then require it to use it.
after installing electron-usb you need to npm install electron-prebuilt#1.0.2 Must be that version because electron-usb doesn't work with Node version greater than 5.x.

Related

How do i install socket.io c++ client library

I am trying to use socket.io c++ client implementation.I have never used an external library before with c++ so im confused.
This is the library i am trying to use:
https://github.com/socketio/socket.io-client-cpp
So i followed this instructions:
https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md
Installed boost and cmake as its stated and i guess it is fine.
My problem is with the 4th step and the rest of it.
If i run
make install
console throws:
make: *** No rule to make target 'install'. Stop.
current dir looks like:
To be honest i didnt understand what is 5th step, and the installation process in general.How should i include this library in my main.cpp so that i can use it ? What are those visual studio project files generated ?
Edit:
If i open INSTALL visual studio project file and build INSTALL project from solution explorer,i get this error:
Edit2:
After updating websocketpp library now i get this error after build:
if you are having lots of issues this is how i solved mine:
boost 1.7.0 was not working for me.I installed boost 1.65.0
after that update websocketpp library
go to C:\socket.io-client-cpp\.git\modules\lib\websocketpp directory with command line and type
git pull origin master
so after changing boost version to 1.65.0 and updating websocketpp finally it built succesfully.

Cannot open include file 'getopt.h'

Firstly, I know nothing about C/C++, but I am trying to compile LCI https://github.com/justinmeza/lci under Windows 10 with Visual Studio 2015, but I'm getting the following error:
Cannot open include file: 'getopt.h': No such file or directory.
I see that getopt is not part of Visual C so people are saying you have to implement your own. It looks like this is what I need:
https://github.com/skandhurkat/Getopt-for-Visual-Studio/blob/master/getopt.h
Problem is, I don't really know what to do with this file. I've been reading a fair bit and messing around for ages just to compile lci.exe!
Already emailed the OP about this, but here's the steps I followed in order to build lci successfully. The missing step seemed to be that Justin Meza neglected to mention that you need to install CMake as well in order for the install script to work. CMake will allow you to build C code against the glibc headers.
Install MinGW
Install Python 3.5.1 (or latest Windows version)
Install Git for Windows (if you haven't already)
Make sure to enable Git for the Windows command prompt
Install CMake
Add MinGW and Python to your PATH environment variable. I'd double check that your paths to the executables are correct, mine looked like this:
C:\Program Files\mingw-w64\mingw64\bin
C:\Users{username}\AppData\Local\Programs\Python\Python35-32
Run a command prompt as administrator, and go to your Documents folder and clone the lci repository (if you haven't already):
git clone https://github.com/justinmeza/lci.git
Go into the lci directory, and run:
install.py --prefix="C:/Program Files/lci"
Add lci to you PATH, if using the default location add this to the end of your PATH:
C:\Program Files\lci\bin
I would have included some links to the various programs above in steps 1-4 but apparently I don't have enough reputation on StackOverflow for that...you should be able to find them easily enough in a quick Google search.
You should now be able to run lci from any command prompt. A good test would be to run the "HAI WORLD" code at lolcode.org.
Just copy getopt.h to the directory where .c files are, so the compiler can find it.
Based on the linked source code and it's contents, the project you're trying to build appears to be written for Linux. It might be possible to sufficiently rewrite it to be able to compile under Microsoft Windows, and Microsoft's compiler; or perhaps install something like MinGW.
However, given your stated lack of development experience, this does not appear to be something that you could easily handle on your own.

fatal error: GL/gl.h: no such file or directory

So I am trying to get my first c++ app to run but i keep getting this error. The error originates from the freeglut_std.h file.
I have downloaded the freeglut 3.0.0 MinGW Package and placed the files inside their respective directories in my MinGW installation folder but there is no file called gl.h.
I have added the libraries to my project properties
I have checked the question that this should be a duplicate of but the solution given there, install Windows SDK, did not fix my problem.
Normally there's no need to download GL/gl.h; OpenGL is part of the Windows ABI contract, which means that every compiler toolchain that targets the Windows API must provision for compiling the OpenGL version that's specified for the Windows ABI. That would be OpenGL-1.1
If your MinGW installation lacks the GL/gl.h header, something is broken in your particular installation. Note that in some Linux distributions you may have to install the development support files separately. But with MinGW the OpenGL headers should be part of the standard installation.

How to point pyinstaller to the right versions of MSVC?90.dll?

I have a python application that I am trying to build as a pyinstaller distributable. A similar script builds successfully on Linux.
I am building it on Windows 7 x64, but want to build 32-bit binary for better compatibility, so I am using 32-bit python-2.7. Among my dependencies are matplotlib and pyside which require MSVC. I install a package called VCForPython27 from Microsoft.
I run into an error when I run my pyinstaller script. I get the following message:
1250 INFO: Adding Microsoft.VC90.CRT to dependent assemblies of final executable
7428 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
7428 WARNING: Assembly not found
7428 ERROR: Assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none not found
7475 WARNING: lib not found: MSVCR90.dll dependency of C:\Python27\python.exe
7553 INFO: Searching for assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none ...
7553 WARNING: Assembly not found
7553 ERROR: Assembly x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none not found
7662 WARNING: lib not found: MSVCR90.dll dependency of C:\Windows\system32\python27.dll
7662 INFO: Analyzing C:\Python27\lib\site-packages\PyInstaller\loader\_pyi_boots
There are multiple messages like that about both the files MSVCP90.dll and MSVCR90.dll
I can see that I have a folder C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2 that contains versions of both files.
This mismatch occurs both when I install my python packages from Christoph Gohlke's page and with pip (except for matplotlib, which I can't install with pip because of missing dependencies).
Strangely enough pyinstaller makes a binary. Yet, when I try to run it I get a popup saying:
WARNING: file already exists but should not:
C:\Users\Martin\AppData\Local\Temp\_MEI34922\Include\pyconfig.h
Does anyone know how I can do any of the following:
Install the precious x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.21022.8_none assembly? Where can I take this specific version from?
Tell python to look for the other version (x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_5090ab56bcba71c2)?
Solve the pyconfig.h unwanted presence issue? Doesn't seem to lead anywhere, but I thought I should try it too.
Find another way to build my code to a binary? It's a complicated code, running external binaries, but if I have to I will try py2exe, not sure that it would be any better though.
The redistributable package that contains version 9.0.21022.8 of msvcr90.dll and msvcp90.dll can be downloaded from the Microsoft website here. This will help PyInstaller to find the versions it wants and include them with the resulting executable.
Interestingly enough, I'm able to run the executable compiled by PyInstaller with redistributable version 9.0.30729.6161 installed, it just won't package these dlls. I tried to copy the msvc*90.dll's into the dist directory, even tried creating and modifying manifest files, but I would still get an error from python27.dll in the end. Installing any version of VC++ redistributable would fix the issue, but then my package wouldn't be self-containing. I wish I understood what exactly is going on here better...

Boost "no such file or directory"

I'm trying to set up my Code::Blocks work environment on a new computer and I'm having some problems. It's been a long time since I first did this, and now when I open my major project Boost is causing me problems.
I'm fairly new to C++ still and fixing this type of problem is something I have limited experience with.
When I open my project and try to compile it, I get this error:
fatal error: boost/algorithm/string.hpp: No such file or directory|
At this part of one of my header files:
#include <boost/algorithm/string.hpp>
I placed the Boost v1.51.0 library at C:\boost since that is where I'd had it on my other computer. My project is set to search that directory for additional includes but it doesn't seem to be finding the files?
My project used an older version of Boost previously but I doubt that's an issue.
I'm not sure how difficult it is to debug this problem with this limited information so if there's anything else I can provide please let me know.
I'm using Code::Blocks, and have just set up minGW and Visual C++ 2010.
In Ubuntu use
sudo apt-get install libboost-dev
Ensure that you have installed boost-devel package
In Centos execute as root:
yum install boost-devel
then
root#centos6 /]# find / -name boost
/usr/include/boost
/usr/lib64/boost
[root#centos6 /]#