OpenCV 3.1.0: /usr/local/include/opencv2/legacy/legacy.hpp can't compile - c++

I'm getting loads of errors like
/usr/local/include/opencv2/legacy/legacy.hpp:2994:12: error: 'CvSubdiv2DEdge' does not name a type
/usr/local/include/opencv2/legacy/legacy.hpp:3002:12: error: 'CvSubdiv2DPoint' does not name a type
/usr/local/include/opencv2/legacy/legacy.hpp:1757:36: error: 'cv::EM' has not been declared
With OpenCV 2.4.13 it compiles just fine. It looks like they actually forgot to add some necessary includes into legacy.hpp. What's going on?

Sorry for being misleading, but there's actually NO such header in the standard setup. My setup was mixed up with another, older version of opencv, and it wasn't packed into a deb file, just a bunch of files within /usr/local/. Funny thing is, it was a clean install.
After reinstalling the OpenCV from scratch and removing those old files, errors changed to legacy.hpp being missing - which is exactly what is required here.
Here is the proof: http://answers.opencv.org/question/42622/opencv-30-deprecated-opencv_legacy-module/. Also, from OpenCV Transition Guide: "legacy, nonfree modules have been removed. Some algorithms have been moved to different locations and some have been completely rewritten or removed."

Related

error: '_Out_' has not been declared when including <Kinect.h>

I'm using CLion and I need to get some data from the Kinect, but when it comes to #include <Kinect.h> I get the following error:
In file included from C:/PROGRA~1/MICROS~2/Kinect/V2D305~1.0_1/inc/Kinect.h:547,
from C:\Users\fredd\CLionProjects\3D_avatar\main.cpp:19:
C:/PROGRA~1/MICROS~2/Kinect/V2D305~1.0_1/inc/Kinect.INPC.h:109:13: error: '_Out_' has not been declared
_Out_ WAITABLE_HANDLE *waitableHandle) = 0;
^~~~~
And an endless list of similar errors. I think I miss some kind of library that defines this data format, but I really don't know (if that's the problem) which one. I've searched all over the internet and googled for about 3 hours without any result.
How can I solve the error?
Also, is there a better way to make Kinect works with CLion?
I've managed to understand what was going on: MinGW couldn't compile SAL annotations, so I had to switch compiler to MSVC, bundled with Visual Studio. Also, I had to link MatLab with my project since there's no library (except for libfreenect2, which has driven me mad) that can handle a Kinect v2.

Assimp won't build correctly in Code::Blocks - "TVITEMEXW not declared in current scope"

I'm currently working through the LearnOpenGL tutorials, which has been going fine thus far, until I've hit the model loading portion of the tutorial.
LearnOpenGL uses the Assimp library to handle model loading, but I don't seem to be able to get it to build properly (precompiled libraries don't work either for me) - it produces errors within "Display.cpp":
In function 'unzOpenCurrentFile3':
Line 1177: warning: assignment from incompatible pointer type
In member function 'int AssimpView::CDisplay::AddNodeToDisplayList(....'
Line 179 error: 'TVITEMEXW' was not declared in this scope
With the line 179 error appearing to be the main cause of failure. Having looked in the 'Display.cpp' file, the issue is with the following declaration:
TVITEMEXW tvi;
And TVITEMEXW doesn't seem to be declared/included within the file explicitly, but the included headers are stdio.h, stdlib.h, string.h, and "./unzip.h". After some searching, I've found that TVITEMEX is a windows structure with TVITEMEXW as a unicode name (according to this) but I'm fairly new to C++/compilers etc., and don't really know what to do with this information.
I created the Code::Blocks project file with CMake and MinGW from the Assimp 3.2.
Any help would be hugely appreciated, I've been stuck with this for a few days now and can't figure out how to resolve it myself. Apologies if I haven't provided enough/the correct information, I'm not entirely sure exactly what is relevant to the problem.
try replacing TVITEMEXW with TVITEMW and maybe sNew.itemex with sNew.item.

Rinside compilation error with kdb

I sucessfully ran the sample codes in the package. Then I copied code from sample1 into another file of mine and set it up to compile using Makefile.
Also copied sample copies into the same directory.
The samples in the directory compile and run fine.
But using R in my already existing code is giving issues. When compiling it gives an error saying expected unqualified-id before Ă¢returnĂ¢. This happens in the line where I declare RInside R(argc, argv).
Another weird thing i noticed is if i include at the bottom of included files, I get a bunch of errors in Rcpp etc. but if i include it at the top, all those errors disappear.
Also, is the default compile option of -O3 required for the package? I have been using -Ofast for most of my codes. Browsing through the questions here I think I need to make changes to CXXFLAGS in Makevars but i can't find out where.
Any help appreciated.
I have boiled down the errors to another file included in my setup which is "k.h". This is a file which is used to interface c++ with kdb+ database. If I include the file before I get errors in Rcpp classes. When included after RInside, I get the earlier error of unqualified id before return.
This is the file in question: k.h
Resolved: It appears it was a variable name conflict. In all examples we have RInside R(argc, argv). As soon as I changed it to RInside L(argc, argv) everything worked fine. Don't know exactly why this was the case but it solves the problem at least. Tested outputs too.

OpenCV 2.4 : undefined reference to cvRand

I can't find the file I have to include to my code to get cvRand (and all other related functions, such as cvRandInit ... ) to be recognized by the compiler. It's weird, because in the past this code used to work as is. Must be an issue with OpenCV2.4.
Also, when I right-clic on cvRand (I work with Qt Creator) and ask to follow the symbol under the cursor, the IDE open a file called compat.hpp. I have several files named compat.hpp, so I don't know which one I have to include. My OS is Ubuntu 11.04.
So far, I included core.hpp, highgui.hpp, and cv.h.
I googled on this, but couldn't find any related issue... so I guess this is not an issue, and I just miss something stupid.
The includes were obviously right, I figured that it has to be a lib problem, by guessing I found that I had to add libopencv_legacy.so. Everything works fine now, thx stackoverflow.

Debugging SFML Project in Xcode - Install to Blame?

I followed the instructions to set up SFML here. When I check my /Library/Frameworks folder, all the SFML stuff seems to be there. However, when I check out a project my group is working on using SFML, and when I build, I get a ton of errors. These errors do not exist for my other group members. I think (some of) my errors are caused by SFML not recognizing sf::Input as a type.
Here is my code for one of the header classes in my project:
#pragma once
#include "Mover.h"
class InputMover : public Mover
{
public:
InputMover(const sf::Input* pInput);
//error here - expected unqualified-id before * token
protected:
const sf::Input* m_pInput;
//error here - ISO C++ forbids declaration of Input with no type
};
The parts without errors have been taken out. What do you think the problem is?
EDIT, SOLVED:
The problem was that I installed SFML with makefiles before I just did a copy-install. Some files were conflicting. I tracked down the installed files and deleted them. This seemed to fix the problem.
To use the SFML classes you need to include their definitions.
Add #include <SFML/Window/Input.hpp> to the top of your file.
Also note that to use SFML you must also link to the CoreFoundation, Cocoa and OpenGL frameworks, as well as to libfreetype.