Ich habe Opencv für Codeblocks installiert und das Programm läuft gut in Codeblocks. Aber wenn ich versuche, das Programm von Eingabeaufforderung ausführen, bekomme ich einen Fehler als fatal error:opencv2/opencv.hpp No such file or directory compilation terminated
Undefinierter Referenzfehler mit OpenCV in Codeblocks für Windows
So lief ich den Befehl als
g++ -IC:\opencv\build\include -o main.exe main.cpp
Und ich bekomme viele undefinierte Referenz errors.I haben sogar versucht, die Verknüpfung Bibliotheken als
g++ -IC:\opencv\build\include -LC:\opencv\build\x86\mingw\lib -o main.exe main.cpp
Noch bekomme ich gleiche errors.I Verwendung OpenCV 2.4.5.I nicht Option -l verwendet haben, da es viele Bibliotheken sind und ich weiß nicht, wie all diese Bibliotheken zu verknüpfen (Verzeichnis) auf einmal.
Dies ist die Kompilierausgabe.
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x6d): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xb7): undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x152): undefined reference to `cv::Mat::zeros(int, int, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x322): undefined reference to `cv::noArray()'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x384): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x3bd): undefined reference to `cv::meanStdDev(cv::_InputArray const&, cv::_OutputArray const&, cv::_OutputArray const&, cv::_InputArray const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x5c7): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x5ea): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x645): undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x665): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x685): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x6d6): undefined reference to `cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x705): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x752): undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x775): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x7c2): undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x7e5): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x808): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x828): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x86e): undefined reference to `cv::inpaint(cv::_InputArray const&, cv::_InputArray const&, cv::_OutputArray const&, double, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x89e): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x8be): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x910): undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x92a): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x971): undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xc68): undefined reference to `cv::namedWindow(std::string const&, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xcee): undefined reference to `cv::imread(std::string const&, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xd3f): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xd8c): undefined reference to `cv::Mat::convertTo(cv::_OutputArray const&, int, double, double) const'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xe05): undefined reference to `cv::operator-(cv::Scalar_<double> const&, cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xe6b): undefined reference to `cv::operator+(cv::Mat const&, cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xebb): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xede): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xf2f): undefined reference to `cv::threshold(cv::_InputArray const&, cv::_OutputArray const&, double, double, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xf74): undefined reference to `cv::_OutputArray::_OutputArray(cv::Mat&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xf97): undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0xff2): undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x103d): undefined reference to `cv::operator*(cv::Mat const&, double)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x105d): undefined reference to `cv::_InputArray::_InputArray(cv::MatExpr const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x10b8): undefined reference to `cv::imwrite(std::string const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text+0x1110): undefined reference to `cv::waitKey(int)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text$_ZN2cv3MatD1Ev[__ZN2cv3MatD1Ev]+0x2d): undefined reference to `cv::fastFree(void*)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text$_ZN2cv3MataSERKS0_[__ZN2cv3MataSERKS0_]+0x102): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text$_ZN2cv3Mat7releaseEv[__ZN2cv3Mat7releaseEv]+0x3e): undefined reference to `cv::Mat::deallocate()'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text$_ZNK2cv3MatclENS_5RangeES1_[__ZNK2cv3MatclENS_5RangeES1_]+0x23): undefined reference to `cv::Mat::Mat(cv::Mat const&, cv::Range const&, cv::Range const&)'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text$_ZN2cv12_OutputArrayC1IdLi4ELi1EEERNS_4MatxIT_XT0_EXT1_EEE[__ZN2cv12_OutputArrayC1IdLi4ELi1EEERNS_4MatxIT_XT0_EXT1_EEE]+0x21): undefined reference to `vtable for cv::_OutputArray'
C:\Users\HP\AppData\Local\Temp\ccraot3b.o:main.cpp:(.text$_ZN2cv11_InputArrayC2IdLi4ELi1EEERKNS_4MatxIT_XT0_EXT1_EEE[__ZN2cv11_InputArrayC2IdLi4ELi1EEERKNS_4MatxIT_XT0_EXT1_EEE]+0xe): undefined reference to `vtable for cv::_InputArray'
collect2.exe: error: ld returned 1 exit status
Bitte fügen Sie die Compile-Ausgabe zur Frage hinzu! – hyde