Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Opencv4 undefined types

After installing opencv4 dynamically using cmake:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Libs/opencv/dynamic ..

I tried to test on a simple example

include <opencv4 opencv2="" core.hpp="">

include <opencv4 opencv2="" highgui.hpp="">

include <opencv4 opencv2="" imgcodecs.hpp="">

include <opencv4 opencv2="" imgproc.hpp="">

int main(int argc, char **argv) { if (argc != 2) { std::cout << "usage: DisplayImage.out <image_path>\n" << std::endl; return -1; }

cv::Mat image = cv::imread(std::string{argv[1]}); if (!image.data) { printf("No image data \n"); return -1; }

cv::rectangle(image, cv::Point(0, 0), cv::Point(112, 112), cv::Scalar(0, 255, 0), 10, cv::LINE_4); cv::putText(image, "Opencv", cv::Point(0, 112), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(255, 0, 225)); cv::imshow("The most useless library in the world", image); cv::waitKey(0); return 0; }

I get the following errors

error : use of undeclared identifier 'image' error : no member named 'Point' in namespace 'cv' error : calling 'waitKey' with incomplete return type 'cv::CV_EXPORTS_W'

Basically there are forward declarations of the types but they do not seem to be defined anywhere

Opencv4 undefined types

After installing opencv4 dynamically using cmake:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Libs/opencv/dynamic ..

I tried to test on a simple example

include <opencv4 opencv2="" core.hpp="">

include <opencv4 opencv2="" highgui.hpp="">

include <opencv4 opencv2="" imgcodecs.hpp="">

include <opencv4 opencv2="" imgproc.hpp="">

int main(int argc, char **argv) { if (argc != 2) { std::cout << "usage: DisplayImage.out <image_path>\n" << std::endl; return -1; }

cv::Mat image = cv::imread(std::string{argv[1]}); if (!image.data) { printf("No image data \n"); return -1; }

cv::rectangle(image, cv::Point(0, 0), cv::Point(112, 112), cv::Scalar(0, 255, 0), 10, cv::LINE_4); cv::putText(image, "Opencv", cv::Point(0, 112), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(255, 0, 225)); cv::imshow("The most useless library in the world", cv::imshow("Opencv 4", image); cv::waitKey(0); return 0; }

I get the following errors

error : use of undeclared identifier 'image' error : no member named 'Point' in namespace 'cv' error : calling 'waitKey' with incomplete return type 'cv::CV_EXPORTS_W'

Basically there are forward declarations of the types but they do not seem to be defined anywhere

click to hide/show revision 3
None

updated 2019-08-07 10:06:20 -0600

berak gravatar image

Opencv4 undefined types

After installing opencv4 dynamically using cmake:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/Libs/opencv/dynamic ..

I tried to test on a simple example

include <opencv4 opencv2="" core.hpp="">

include <opencv4 opencv2="" highgui.hpp="">

include <opencv4 opencv2="" imgcodecs.hpp="">

include <opencv4 opencv2="" imgproc.hpp="">

#include <opencv4/opencv2/core.hpp>
#include <opencv4/opencv2/highgui.hpp>
#include <opencv4/opencv2/imgcodecs.hpp>
#include <opencv4/opencv2/imgproc.hpp>

int main(int argc, char **argv) {
if (argc != 2) {
std::cout << "usage: DisplayImage.out <image_path>\n" <Image_Path>\n" << std::endl;
return -1;
}

} cv::Mat image = cv::imread(std::string{argv[1]}); if (!image.data) { printf("No image data \n"); return -1; }

} cv::rectangle(image, cv::Point(0, 0), cv::Point(112, 112), cv::Scalar(0, 255, 0), 10, cv::LINE_4); cv::putText(image, "Opencv", cv::Point(0, 112), cv::FONT_HERSHEY_COMPLEX_SMALL, 0.8, cv::Scalar(255, 0, 225)); cv::imshow("Opencv 4", image); cv::waitKey(0); return 0; }

}

I get the following errors

error : use of undeclared identifier 'image'
error : no member named 'Point' in namespace 'cv'
error : calling 'waitKey' with incomplete return type 'cv::CV_EXPORTS_W'

'cv::CV_EXPORTS_W'

Basically there are forward declarations of the types but they do not seem to be defined anywhere