Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile with opencv-3.4.1 #1

Open
kami83 opened this issue Sep 7, 2018 · 1 comment
Open

Cannot compile with opencv-3.4.1 #1

kami83 opened this issue Sep 7, 2018 · 1 comment

Comments

@kami83
Copy link

kami83 commented Sep 7, 2018

Hi,
if i am trying to compile your sourcecode i get this output from cmake:
sudoku-recognizer/build # cmake ..
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found suitable version "3.4.1", minimum required is "3.1.0") found components: core
OpenCV version : 3.4.1
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - not found
-- Looking for CL_VERSION_2_1
-- Looking for CL_VERSION_2_1 - found
-- Found OpenCL: /usr/lib/arm-linux-gnueabihf/libOpenCL.so (found version "2.1")
-- Boost version: 1.67.0
-- Found the following Boost libraries:
-- unit_test_framework
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kami/sourcecode/sudoku-recognizer/build

and when i try to compile i get this error:

sudoku-recognizer/build # make
Scanning dependencies of target hello
[ 4%] Building CXX object src/CMakeFiles/hello.dir/lib/hello.cpp.o
[ 8%] Linking CXX static library libhello.a
[ 8%] Built target hello
Scanning dependencies of target whereami
[ 12%] Building C object src/CMakeFiles/whereami.dir/lib/whereami.c.o
[ 16%] Linking C static library libwhereami.a
[ 16%] Built target whereami
Scanning dependencies of target sudoku
[ 20%] Building CXX object src/CMakeFiles/sudoku.dir/lib/sudoku.cpp.o
/home/kami/sourcecode/sudoku-recognizer/src/lib/sudoku.cpp: In function ‘std::vector<double, std::allocator > findBiggestComponent(cv::Mat)’:
/home/kami/sourcecode/sudoku-recognizer/src/lib/sudoku.cpp:833:133: note: parameter passing for argument of type ‘std::initializer_list’ will change in GCC 7.1
return {(double)left, (double)top, (double)width, (double)height, centroids.at(index, 0), centroids.at(index, 1)};
^
In file included from /usr/include/c++/6/vector:64:0,
from /usr/local/include/opencv2/core/types.hpp:53,
from /usr/local/include/opencv2/core.hpp:58,
from /usr/local/include/opencv2/opencv.hpp:52,
from /home/kami/sourcecode/sudoku-recognizer/src/lib/sudoku.h:5,
from /home/kami/sourcecode/sudoku-recognizer/src/lib/sudoku.cpp:1:
/usr/include/c++/6/bits/stl_vector.h: In constructor ‘std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = double; _Alloc = std::allocator]’:
/usr/include/c++/6/bits/stl_vector.h:375:7: note: parameter passing for argument of type ‘std::initializer_list’ will change in GCC 7.1
vector(initializer_list<value_type> __l,
^~~~~~
[ 25%] Linking CXX static library libsudoku.a
[ 25%] Built target sudoku
Scanning dependencies of target mouline
[ 29%] Building CXX object src/CMakeFiles/mouline.dir/main.cpp.o
[ 33%] Linking CXX executable mouline
CMakeFiles/mouline.dir/main.cpp.o: In function main': main.cpp:(.text+0x124): undefined reference to cv::imread(cv::String const&, int)'
libsudoku.a(sudoku.cpp.o): In function getKnn(cv::FileStorage)': sudoku.cpp:(.text+0x39f8): undefined reference to cv::ml::KNearest::create()'
libsudoku.a(sudoku.cpp.o): In function getSvm(cv::FileStorage)': sudoku.cpp:(.text+0x3d10): undefined reference to cv::ml::SVM::create()'
sudoku.cpp:(.text+0x3e1c): undefined reference to cv::ml::TrainData::create(cv::_InputArray const&, int, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&, cv::_InputArray const&)' libsudoku.a(sudoku.cpp.o): In function showImage(cv::Mat)':
sudoku.cpp:(.text+0x5df8): undefined reference to cv::namedWindow(cv::String const&, int)' sudoku.cpp:(.text+0x5e38): undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)'
sudoku.cpp:(.text+0x5e58): undefined reference to `cv::waitKey(int)'
collect2: error: ld returned 1 exit status
src/CMakeFiles/mouline.dir/build.make:87: die Regel für Ziel „src/mouline“ scheiterte
make[2]: *** [src/mouline] Fehler 1
CMakeFiles/Makefile2:221: die Regel für Ziel „src/CMakeFiles/mouline.dir/all“ scheiterte
make[1]: *** [src/CMakeFiles/mouline.dir/all] Fehler 2
Makefile:94: die Regel für Ziel „all“ scheiterte
make: *** [all] Fehler 2

Can you please help me?

Thanks a lot.

Cu kami

@kami83
Copy link
Author

kami83 commented Sep 12, 2018

Problem fixed: Just change this line in sudoku-recognizer/src/CMakeLists.txt:

set(OpenCV_LIBS opencv_core opencv_objdetect opencv_ml opencv_imgcodecs opencv_highgui)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant