Eclipse 给出"weird"关于 opencv 的错误
Eclipse giving "weird" error concerning opencv
我正在运行ubuntu 12.04。我有一个 c++ 项目,我在 Eclipse(luna 之前的版本(中编写和编译得很好。我的系统遇到了一些问题,不得不重新安装操作系统。现在我正在使用Eclipse luna,该项目在使用某些openCV功能时给出了一个奇怪的错误。
当我使用cv::namedWindow()
和cv::imshow()
时,我遇到的错误。错误是:
以下是 eclipse 控制台输出:
00:21:45 **** Incremental Build of configuration Debug for project MySOM ****
make all
Building target: MySOM
Invoking: Cross G++ Linker
g++ -L/usr/local/lib -o "MySOM" ./src/LoadFile.o ./src/Model.o ./src/Node.o ./src/SOM.o ./src/main.o -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab
Finished building target: MySOM
00:21:45 Build Finished (took 210ms)
它看起来在上面找到,但随后...
以下是日食中的"问题"选项卡:
Description Resource Path Location Type
Invalid arguments '
Candidates are:
bool imwrite(const ? &, const cv::_InputArray &, const ? &)
' SOM.cpp /MySOM/src line 211 Semantic Error
Invalid arguments '
Candidates are:
cv::Mat imread(const ? &, int)
' LoadFile.cpp /MySOM/src line 10 Semantic Error
Invalid arguments '
Candidates are:
void imshow(const ? &, const cv::_InputArray &)
' main.cpp /MySOM/src line 22 Semantic Error
Invalid arguments '
Candidates are:
void namedWindow(const ? &, int)
' main.cpp /MySOM/src line 21 Semantic Error
主.cpp
#include "Node.h"
#include <iostream>
#include "SOM.h"
#include <string>
#include "opencv2/core/core.hpp"
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>//FOR TESTING
void MyPause(std::string msg){
if(msg != ""){
std::cout << "[+] " << msg << std::endl;
}
std::cout << "Press enter to continue" << std::endl;
std::cin.get();
}
void DisplayMat(cv::Mat img){
static int number = 0;
cv::namedWindow( "Input" + number, cv::WINDOW_AUTOSIZE );// ERROR HERE
cv::imshow( "Input" + number, img );//ERROR HERE
cv::waitKey(0);
number++;
return;
}
std::string filename = "/home/myUserName/Code/projectFiles/testMedia/myYellow.jpg";
int main(){
//cv::Mat inputImg = LoadFile(filename);
SOM som(filename);
MyPause("After SOM initialization");
DisplayMat(som.inputImg);
MyPause("END OF MAIN");
return 0;
}
我想知道这是否会发生,因为与我在原始系统上编译它的方式相比,我现在编译 opencv 的方式。
当我升级日食时,这种情况一直发生在我身上。它有Member declaration not found
,invalid overload of endl
,Invalid arguments ...
的所有奇怪错误,现在我发现这是工作区中的信息,旧项目对于新的CDT codan来说不是最新的。解决这个问题其实很容易:Project->C/C++ index->Rebuild
。完成后,所有奇怪的错误都会消失。
在执行此操作之前,我已经尝试了 3 次刷新、清洁和重建,但似乎在发布后我尝试了第四次只是为了确保它已经起作用了。
此表达式无效:"Input" + number
.不能只将字符串文字与数字连接起来。好吧,你可以,但结果不会是你所期望的。
幸运的是,您正在C++编程,这意味着您可以使用std::string
和std::to_string
(如果您有兼容C++11的编译器(:std::string("Input") + std::to_string(number)
。
如果您没有 C++11,因此没有 std::to_string
,那么您可以使用例如 Boost 词法转换库,或std::istringstream
来格式化字符串,或其他格式化函数/库。
- 如何修复"未定义的引用"错误 opencv 和 g++
- 链接错误 Opencv Qt '_ZN2cv6String10deallocateEv
- 错误 opencv 错误断言失败 (p [-1] <= 2) 是什么意思以及如何处理它?
- 错误:OpenCV 3.4.0 CUDA ORB 功能检测
- 调试断言错误-OpenCV
- 在 Ubuntu 中选择超时错误 - Opencv
- 内存不足错误Opencv/c++
- 'Corrupted double-linked list'内存错误 - OpenCV-Python 3.0.0 和 ARM 上的 Numpy
- 链接错误 OpenCV 仅在使用 -wl,-rpath,/usr/local/MATLAB/R2014b/bin/gln
- 人脸跟踪错误 Opencv
- 致命错误:opencv/cvtypes.h:没有终止此类文件或目录编译
- Sobel 边缘检测错误(OpenCV 错误:断言失败 (DIMS<=2&&Data&&(无符号)i0)
- 我正在尝试将灰度转换为更大的黑色图像.我得到这个错误OpenCV错误:断言失败
- 分段错误 - OpenCV 和 Qt in Netbeans on Ubuntu
- Visual Studio 2013中C++中的VideoCapture错误OpenCV 3.0.0
- 如何修复内存不足错误(openCV)
- 错误 OpenCV 在 C++ 中支持 CUDA
- 图像轮廓检测错误:OpenCV,C++
- c++分割错误OpenCV
- 编译错误opencv