User forums > Using Code::Blocks
opencv 4.1.0 on Jeston Nano linking with CB
Gandalf2019:
I installed opencv 4.1.0 using the following modified installer it worked perfect (you only need to increase memory swap - I increased it to 8GB).
install_opencv4.1.0_Nano.sh (here is the following code for your use by the end of this post - without swap modification).
I made some modification in the original file, one of them is that i skipped installing python 2 binding if someone need it change the flag -D BUILD_opencv_python2=OFF to ON).
After installation, when running opencv c++ code using cmake and CMakeLists.txt (as recommended by opencv) everything works perfectly (i tested opencv version and get 4.1.0), I've tested cuda acceleration with opencv and it works, perfectly. i tested python 3 as well and everything works good.
I downloaded and install latest code::blocks IDE, and tested the hello world with native GCC compiler (default).
when trying to link opencv and use this IDE nothing works, no auto-complete, build errors etc.
i set the following:
1. compiler search directories: /usr/local/include/opencv4/
2. linker tab - usr/local/bin/
3. tried list of libs.
I'll appreciate if someone will try the installer below, and provide instructions (for dummies), how to link latest code:blocks IDE with this opencv installation that can be build and run\debug using it, with autocomplete.
many thanks
--- Code: --- #!/bin/bash
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.
#
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <Install Folder>"
exit
fi
folder="$1"
user="nvidia"
passwd="nvidia"
echo "** Remove OpenCV3.3 first"
sudo sudo apt-get purge *libopencv*
echo "** Install requirement"
sudo apt-get update
sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy
sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp
sudo apt-get install -y curl
sudo apt-get update
echo "** Download opencv-4.1.0"
cd $folder
curl -L https://github.com/opencv/opencv/archive/4.1.0.zip -o opencv-4.1.0.zip
curl -L https://github.com/opencv/opencv_contrib/archive/4.1.0.zip -o opencv_contrib-4.1.0.zip
unzip opencv-4.1.0.zip
unzip opencv_contrib-4.1.0.zip
cd opencv-4.1.0/
echo "** Building..."
mkdir release
cd release/
cmake -D WITH_CUDA=ON -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules -D OPENCV_ENABLE_NONFREE=OFF -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j3
sudo make install
s
echo "** Install opencv-4.1.0 successfully"
echo "** Bye :)"
--- End code ---
BlueHazzard:
"nothing works" is absolutely no adequate problem description....
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F
Gandalf2019:
Great, it is a great help 8) many thanks.
to make my question\s short, previous linking DOES NOT WORK. Hence, if any linking option that i've tried doesn't work guess what the errors are? are the same as if i linked nothing.
I truely need assistance with it.
the only thing that links and compiled is if i write the line:
#include <opencv2/opencv.hpp>
and on compiler tab (search directories) i include the following path: /usr/local/include/opencv4/
the rest linking is a puzzle
BlueHazzard:
Still we NEED the FULL REBUILD LOG to help you.... This is clearly written in the FAQ
without error log no help, not because we do not want, but because we do not can...
Gandalf2019:
Hi,
I made some progress. and now i can share build error that may hint the nature of the linking error.
the error:
--- Quote ----------------- Build: Release in test1 (compiler: GNU GCC Compiler)---------------
g++ -L/usr/local/lib/ -o bin/Release/test1 obj/Release/main.o -s -Iopencv_cudev -Iopencv_core -Iopencv_cudaarithm -Iopencv_flann -Iopencv_imgproc -Iopencv_ml -Iopencv_phase_unwrapping -Iopencv_plot -Iopencv_quality -Iopencv_reg -Iopencv_surface_matching -Iopencv_cudafilters -Iopencv_cudaimgproc -Iopencv_cudawarping -Iopencv_dnn -Iopencv_freetype -Iopencv_fuzzy -Iopencv_gapi -Iopencv_hfs -Iopencv_img_hash -Iopencv_imgcodecs -Iopencv_photo -Iopencv_videoio -Iopencv_xphoto -Iopencv_cudacodec -Iopencv_highgui -Iopencv_bioinspired -Iopencv_dnn_objdetect -Iopencv_features2d -Iopencv_line_descriptor -Iopencv_saliency -Iopencv_text -Iopencv_calib3d -Iopencv_ccalib -Iopencv_cudafeatures2d -Iopencv_cudastereo -Iopencv_datasets -Iopencv_objdetect -Iopencv_rgbd -Iopencv_shape -Iopencv_structured_light -Iopencv_video -Iopencv_xfeatures2d -Iopencv_ximgproc -Iopencv_xobjdetect -Iopencv_aruco -Iopencv_bgsegm -Iopencv_cudabgsegm -Iopencv_cudalegacy -Iopencv_cudaobjdetect -Iopencv_dpm -Iopencv_face -Iopencv_optflow -Iopencv_stitching -Iopencv_tracking -Iopencv_cudaoptflow -Iopencv_stereo -Iopencv_superres -Iopencv_videostab
obj/Release/main.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x84): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x94): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End quote ---
the source code is in the following screenshot:
--- Code: ---#include <iostream>
#include <opencv2/opencv.hpp>
int main()
{
cv::Mat A;
std::cout << "Opencv linked" << std::endl;
return 0;
}
--- End code ---
in "Search directories" tab > Compiler i added the following link: /usr/local/include/opencv4/
in "Search directories" tab > Linker i added the following link: /usr/local/lib/
in "linker setting" tab > i added the list that appears in the error message. \
I'm sure it is linking error.
please advise
Navigation
[0] Message Index
[#] Next page
Go to full version