Guten Morgen zusammen,
ich hab mir Code::Blocks auf der Raspi installiert weil das Buch "c++ für Dummies" damit arbeitet.
Da ich mich in openCV einarbeiten möchte hab ich ein neues Projekt geöffnet und dort ein openCV-Projekt ausgewählt.
Und siehe da, Code::Blocks hat mir direkt ein Beispielprogramm vorgegeben:
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
int main(int argc, char *argv[])
{
Mat img = imread("lena.jpg", CV_LOAD_IMAGE_COLOR);
if(img.empty())
return -1;
namedWindow( "lena", CV_WINDOW_AUTOSIZE );
imshow("lena", img);
waitKey(0);
return 0;
}
Alles anzeigen
Wenn ich dann aus Build klicke gibts folgende Fehlermeldungen:
||=== Build: Debug in Test1 (compiler: GNU GCC Compiler) ===|
obj/Debug/main.o||In function `main':|
/home/pi/Test1/main.cpp|8|undefined reference to `cv::imread(std::string const&, int)'|
/home/pi/Test1/main.cpp|11|undefined reference to `cv::namedWindow(std::string const&, int)'|
/home/pi/Test1/main.cpp|12|undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'|
/home/pi/Test1/main.cpp|12|undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)'|
/home/pi/Test1/main.cpp|13|undefined reference to `cv::waitKey(int)'|
obj/Debug/main.o||In function `cv::Mat::~Mat()':|
/usr/include/opencv2/core/mat.hpp|278|undefined reference to `cv::fastFree(void*)'|
obj/Debug/main.o||In function `cv::Mat::release()':|
/usr/include/opencv2/core/mat.hpp|367|undefined reference to `cv::Mat::deallocate()'|
||=== Build failed: 7 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
Alles anzeigen
Ich hab dann unter "Projekt -> Build Options... -> Linker Settings -> Add" die Pfade von opencv (/usr/include/opencv) und opencv2 (/usr/include/opencv2) eingefügt.
Das hat leider nichts gebracht.
Der Meldung:
/usr/include/opencv2/core/mat.hpp|278|undefined reference to `cv::fastFree(void*)
bin ich mal nachgegangen. Da wird fastFree nur benutzt, nicht erzeugt:
[/size][/color][color=#141414][size=12]inline Mat::~Mat()[/size][/color]{ release(); if( step.p != step.buf ) fastFree(step.p);[color=#141414][size=12]}[/size][/color][color=#141414][size=12]
[/size][/color]
Was mache ich falsch?
War das angeben der Linker richtig?