PCAN USB QT Interfacing issue - c++

I recently purchased one PCAN USB device. I am having trouble interfacing the APIs with my Qt GUI.
I am using #include <libpcan.h> and #include <pcan.h> in my code as mentioned in one sample code. I am compiling the code with -lpcanfd compiler flag . Once I add #include <libpcan.h> in the header and compile my Qt code I get an error like this:
/usr/include/x86_64-linux-gnu/qt5/QtCore/qthread.h:53:16: error:
expected unqualified-id before 'void' static Qt::HANDLE
currentThreadId() Q_DECL_NOTHROW;
If i comment #include <libpcan.h> the compile process finished without error(s). Can anyone suggest me a solution? Without including libpcan header I won't be able to use the device.

Related

CGAL file not found after installation

I recently installed CGAL from their website. I used the native installer that is up to download on the website, and after selecting a directory, the installation completed. I am looking through the User Manual and trying to run some basic code, but I keep getting a compiler error. The code that I run is this (it is straight from the user manual):
// example: construct a quadratic program from data
// the QP below is the first quadratic program example in the user manual
#include <iostream>
#include <cassert>
#include <CGAL/basic.h>
#include <CGAL/QP_models.h>
#include <CGAL/QP_functions.h>
// choose exact integral type
#ifdef CGAL_USE_GMP
#include <CGAL/Gmpz.h>
typedef CGAL::Gmpz ET;
#else
#include <CGAL/MP_Float.h>
typedef CGAL::MP_Float ET;
#endif
int main()
{
}
It is just a simple QP problem, using the syntax straight from the website. However, when I try to run it, I receive this compiler error:
C:\...\include\CGAL\config.h|161|fatal error: CGAL/compiler_config.h: No such file or directory|
I used the installer straight from the website, but CGAL is still giving me these issues. Does anyone know how to solve it? Thank you.
According to the documentation (https://doc.cgal.org/latest/Manual/installation.html#title5), after installing CGAL on Windows, you still need to build the library itself.
This process will (I suspect) create the missing configuration files according to the compiler you have (gcc 7.3).

ESP8266WebServer.h, "functional: No such file or directory"

I tried to install library ESP8266WebServer into platformio IDE.
I got this error "functional: No such file or directory". A bit of research of "functional", http://www.cplusplus.com/reference/functional/
In file included from configMode.cpp:13:0:
.pioenvs/uno/ESP8266WebServer/ESP8266WebServer.h:27:22: fatal error: functional: No such file or directory
#include <functional>
^
compilation terminated.
In my case the very same error happened when I was trying to
#include <ESP8266WebServer.h>
in a .c file.
It should be .cpp in order to compile without errors.
I had this problem, but realised I had the wrong board set in the Arduino IDE. If you haven't installed the Arduino core for ESP8266 (https://github.com/esp8266/Arduino#installing-with-boards-manager) do so, then select the correct board from the Arduino IDE Tools menu.
I now have other compiler errors though.

OpenCV: ‘AlgorithmInfo’ does not name a type while building opencv_contrib

I am getting the following error while trying to build opencv with the contrib module
/opencv/opencv_contrib/modules/tracking/include/opencv2/tracking/tracker.hpp:577:11: error: ‘AlgorithmInfo’ does not name a type
The code is latest and pulled just now.
After adding a forward declaration class AlgorithmInfo; to the file tracker.hpp that particular error is gone but I am getting other '‘AlgorithmInfo’ does not name a type' errors in other files. Probably AlgorithmInfo is not getting included somehow. Any ideas?
Investigation:
After grepping AlgorithmInfo I found that there is no defination of AlgorithmInfo in the code base.
Comparing to the previous version of code I found AlgorithmInfo is defined at opencv2/core.hpp line 3006. But in the latest code, it is not present there at all!
This is not a permanent solution but I had the same issue and here is how i was able to continue work on the project until someone finds a better way.
I looked at the link that Utkarsh posted How do I use SIFT in OpenCV 3.0 with c++?
To summarize I had to get the opencv_contrib repo and remake opencv.
After doing so I still got the same error and eventually realized that
you must include
#include "opencv2/xfeatures2d.hpp"
#include "opencv2/features2d/features2d.hpp"
but you still get the same unless you also remove/comment out
//#include "opencv2/nonfree/features2d.hpp"
//#include "opencv2/nonfree/nonfree.hpp"
anyway this is how i got around the error for the time being.

C++ project build, but IDE shows error

Error: cannot open source file "GL/glew.h"
I have the following code :
//Include GLEW
#include <GL/glew.h>
//Include GLFW
#include <GLFW/glfw3.h>
//Include the standard C++ headers
#include <stdio.h>
#include <stdlib.h>
//Define an error callback
static void error_callback(int error, const char* description)
{
...
I took from there: http://www.41post.com/5178/programming/opengl-configuring-glfw-and-glew-in-visual-cplusplus-express#part4
In order to have a somewhat portable solution, before I even started Visual Studio 2013 I created two System Environment Variable in windows.
GLEW=C:\Install\Development\C++\Framework\glew-1.10.0-win32\glew-1.10.0
GLFW=C:\Install\Development\C++\Framework\glfw-3.0.4.bin.WIN32\glfw-3.0.4.bin.WIN32
So in my project I could for instance write a additional include folder as: %GLEW%\include
As I said, it builds fine and runs fine as well.
Yet, not having intellisense behave properly is really annoying.
How to fix it?
My syntax was actually wrong, you cant use global environment variable in VS using %<name>% but you have to use $(%<name>).
Wherever I wrote %GLEW%\include I should have $(GLEW)\include.
It's working fine now.
Though I'm completely clueless why it built.
This post: https://stackoverflow.com/a/11543754/910813 got me to remind that.

C++ Non-Class member compile error in Code::Blocks?

I am attempting to follow the tutorial found here to learn the basic idea behind programming roguelike game. I am using Code::Blocks 10.05 running portable from my usb and compiling with MinGW. Console.h also came from the website I linked above.
I have hit a road block when I have attempted to set up just this class to ensure everything is working:
#include <conio.h>
#include "Console.h"
int main( void )
{
console.Clear();
return 0;
}
When I attempt to use the I get the following error:
Error: request for member 'Clear' in 'console', which is of non-class type 'Win32Console()'|
Any help is appreciated, thanks!
Edit
I reinstalled MinGW and Code::Blocks after promptly ruining them for myself and am now back with the error:
undefined reference to `Win32Console::Win32Console()
before adding the header file, paste this line: #define _WIN32. Its possible that the _WIN32 isn't defined?