opencv in clion

发布于 2025-02-12 14:44:56 字数 1849 浏览 0 评论 0原文

嗨,我遇到了这个错误,我已经在cygwin

/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::String::~String()':
/usr/include/opencv2/core/cvstd.hpp:648: undefined reference to `cv::String::deallocate()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::String::operator=(cv::String const&)':
/usr/include/opencv2/core/cvstd.hpp:656: undefined reference to `cv::String::deallocate()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::Mat::~Mat()':
/usr/include/opencv2/core/mat.inl.hpp:704: undefined reference to `cv::fastFree(void*)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::Mat::release()':
/usr/include/opencv2/core/mat.inl.hpp:816: undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/imageprocessing.dir/build.make:93: imageprocessing.exe] Error 1
make[2]: *** [CMakeFiles/Makefile2:83: CMakeFiles/imageprocessing.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/imageprocessing.dir/rule] Error 2
make: *** [Makefile:124: imageprocessing] Error 2**

cmake_minimum_required(VERSION 3.20)
project(imageprocessing)

set(CMAKE_CXX_STANDARD 23)

add_executable(imageprocessing main.cpp)

find_package( OpenCV REQUIRED )

。用户代码

#include <iostream>
#include <opencv2/opencv.hpp>
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;

int main() {
    Mat image;
    cout << "Hello, World!" << std::endl;
    return 0;
}

Hi I am getting this error I have installed OpenCV libraries in Cygwin Libraries

/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::String::~String()':
/usr/include/opencv2/core/cvstd.hpp:648: undefined reference to `cv::String::deallocate()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::String::operator=(cv::String const&)':
/usr/include/opencv2/core/cvstd.hpp:656: undefined reference to `cv::String::deallocate()'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::Mat::~Mat()':
/usr/include/opencv2/core/mat.inl.hpp:704: undefined reference to `cv::fastFree(void*)'
/usr/lib/gcc/x86_64-pc-cygwin/11/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles/imageprocessing.dir/main.cpp.o: in function `cv::Mat::release()':
/usr/include/opencv2/core/mat.inl.hpp:816: undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/imageprocessing.dir/build.make:93: imageprocessing.exe] Error 1
make[2]: *** [CMakeFiles/Makefile2:83: CMakeFiles/imageprocessing.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/imageprocessing.dir/rule] Error 2
make: *** [Makefile:124: imageprocessing] Error 2**

CMakeList.txt

cmake_minimum_required(VERSION 3.20)
project(imageprocessing)

set(CMAKE_CXX_STANDARD 23)

add_executable(imageprocessing main.cpp)

find_package( OpenCV REQUIRED )

User Code

#include <iostream>
#include <opencv2/opencv.hpp>
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;

int main() {
    Mat image;
    cout << "Hello, World!" << std::endl;
    return 0;
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文