2015-09-04 3 views
1

Я пытаюсь запустить следующий код, который я нашел в Интернете, чтобы увидеть, если я настроил OpenCV правильно,OpenCV с Netbeans C++ ошибка линкера

#include "opencv2/opencv.hpp" 
#include "opencv2/highgui/highgui.hpp" 

using namespace std; 

int main(int argc, char** argv) { 

namedWindow("Output",1); 

//initialize a 120X350 matrix of black pixels: 
Mat output = Mat::zeros(120, 350, CV_8UC3); 

//write text on the matrix: 
putText(output, 
     "Hello World :)", 
     cvPoint(15,70), 
     FONT_HERSHEY_PLAIN, 
     3, 
     cvScalar(0,255,0), 
     4); 

//display the image: 
imshow("Output", output); 

//wait for the user to press any key: 
waitKey(0); 

return 0; 

} 

И я получаю следующие ошибки, когда я компилировать,

main.cpp: In function 'int main(int, char**)': 
main.cpp:12:27: error: 'namedWindow' was not declared in this scope 
main.cpp:15:5: error: 'Mat' was not declared in this scope 
main.cpp:15:9: error: expected ';' before 'output' 
main.cpp:18:13: error: 'output' was not declared in this scope 
main.cpp:21:13: error: 'FONT_HERSHEY_PLAIN' was not declared in this  scope 
main.cpp:24:14: error: 'putText' was not declared in this scope 
main.cpp:27:28: error: 'imshow' was not declared in this scope 
main.cpp:30:14: error: 'waitKey' was not declared in this scope 
nbproject/Makefile-Debug.mk:66: recipe for target `build/Debug/MinGW- Windows/main.o' failed 

Я составил OpenCV 3.0.0 на окнах и я добавил следующие свойства моего проекта, Включить каталоги - E:/программное обеспечение/OpenCV/сборки/включают Дополнительные каталоги библиотеки - E:/software/opencv/release/lib И я добавил все библиотеки в E:/software/opencv/release/lib в библиотеки компоновщиков.

+0

Вы добавили OpenCV в переменную окружения Path? – GPPK

ответ

1

Я думаю это может быть легко исправить. Добавить:

using namespace cv; 

Выше или ниже:

using namespace std; 
+0

спасибо! это сработало !! – normad

Смежные вопросы