Reputation: 351
I'm having a problem inheriting from a class, and looking up the error on the internet is said as being circular includes, but I'm not seeing how I'm doing it on my code.
Here is the error:
./src/Camera.hpp:6:40: error: expected class-name before ‘{’ token
class Camera : public cv::VideoCapture {
The class I'm inheriting from is part of OpenCV. Here is the relevant part of the code:
main.cpp:
#include <opencv2/core.hpp>
#include "Camera.hpp"
int main(int argc, char** argv){
Camera camera = Camera(/*Some parameters*/);
return 0;
}
Camera.hpp
#ifndef CAMERA_H
#define CAMERA_H
#include <opencv2/core.hpp>
class Camera : public cv::VideoCapture {
public:
Camera(/*Some parameters*/);
};
#endif
There are some other files included in main.cpp, but I made sure (to test) that none of them is using Camera.hpp. What am I doing wrong?
Thanks
Upvotes: 0
Views: 72
Reputation: 18964
If it doesn't know VideoCapture
is a class, maybe you haven't included the right header file.
http://docs.opencv.org/java/2.4.8/org/opencv/highgui/VideoCapture.html suggests #include "opencv2/opencv.hpp"
.
Upvotes: 2