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

make error #6

Closed
SunnerLi opened this issue Jan 24, 2016 · 1 comment
Closed

make error #6

SunnerLi opened this issue Jan 24, 2016 · 1 comment

Comments

@SunnerLi
Copy link

Recently, I make this project.
While I encounter some make error.
Share the solving method I use.
The error message is shwon below:

/tmp/ccdIPG5p.o: In function `read_images(boost::filesystem::path const&, unsigned char, std::vector<image, std::allocator<image> >&, int, int)':
main.cpp:(.text+0x773): undefined reference to `cv::imread(cv::String const&, int)'
main.cpp:(.text+0x780): undefined reference to `cv::String::deallocate()'
main.cpp:(.text+0x809): undefined reference to `cv::resize(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, double, double, int)'
main.cpp:(.text+0x9c6): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text+0xa60): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text+0xb1c): undefined reference to `cv::String::allocate(unsigned long)'
main.cpp:(.text+0xb48): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
main.cpp:(.text+0xb64): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text+0xb74): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text+0xc16): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text+0xcb4): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text+0xcd1): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text+0xcde): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text+0xe98): undefined reference to `cv::String::deallocate()'
/tmp/ccdIPG5p.o: In function `exec(std::string const&, std::string const&, int, int, int, bool)':
main.cpp:(.text+0x1848): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text+0x1892): undefined reference to `cv::Mat::deallocate()'
/tmp/ccdIPG5p.o: In function `cv::Mat::~Mat()':
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x81): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x71): undefined reference to `cv::fastFree(void*)'
/tmp/ccdIPG5p.o: In function `std::vector<image, std::allocator<image> >::~vector()':
main.cpp:(.text._ZNSt6vectorI5imageSaIS0_EED2Ev[_ZNSt6vectorI5imageSaIS0_EED5Ev]+0x90): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZNSt6vectorI5imageSaIS0_EED2Ev[_ZNSt6vectorI5imageSaIS0_EED5Ev]+0xb4): undefined reference to `cv::Mat::deallocate()'
/tmp/ccdIPG5p.o: In function `void gen_mnist_images<__gnu_cxx::__normal_iterator<image*, std::vector<image, std::allocator<image> > > >(std::string const&, __gnu_cxx::__normal_iterator<image*, std::vector<image, std::allocator<image> > >, __gnu_cxx::__normal_iterator<image*, std::vector<image, std::allocator<image> > >)':
main.cpp:(.text._Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_[_Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_]+0x356): undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
main.cpp:(.text._Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_[_Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_]+0x3e6): undefined reference to `cv::MatConstIterator::seek(int const*, bool)'
main.cpp:(.text._Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_[_Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_]+0x462): undefined reference to `cv::MatConstIterator::seek(long, bool)'
main.cpp:(.text._Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_[_Z16gen_mnist_imagesIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEEEvRKSsT_SA_]+0x488): undefined reference to `cv::MatConstIterator::seek(long, bool)'
/tmp/ccdIPG5p.o: In function `void std::vector<image, std::allocator<image> >::_M_emplace_back_aux<image const&>(image const&)':
main.cpp:(.text._ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_[_ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_]+0x1f4): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
main.cpp:(.text._ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_[_ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_]+0x288): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_[_ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_]+0x2d4): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_[_ZNSt6vectorI5imageSaIS0_EE19_M_emplace_back_auxIIRKS0_EEEvDpOT_]+0x304): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
/tmp/ccdIPG5p.o: In function `void std::shuffle<__gnu_cxx::__normal_iterator<image*, std::vector<image, std::allocator<image> > >, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul> >(__gnu_cxx::__normal_iterator<image*, std::vector<image, std::allocator<image> > >, __gnu_cxx::__normal_iterator<image*, std::vector<image, std::allocator<image> > >, std::linear_congruential_engine<unsigned long, 16807ul, 0ul, 2147483647ul>&&)':
main.cpp:(.text._ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_[_ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_]+0x3ce): undefined reference to `cv::fastFree(void*)'
main.cpp:(.text._ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_[_ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_]+0x3ff): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
main.cpp:(.text._ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_[_ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_]+0x417): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
main.cpp:(.text._ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_[_ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_]+0x42f): undefined reference to `cv::Mat::copySize(cv::Mat const&)'
main.cpp:(.text._ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_[_ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_]+0x444): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_[_ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_]+0x454): undefined reference to `cv::Mat::deallocate()'
main.cpp:(.text._ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_[_ZSt7shuffleIN9__gnu_cxx17__normal_iteratorIP5imageSt6vectorIS2_SaIS2_EEEESt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEvT_SA_OT0_]+0x464): undefined reference to `cv::Mat::deallocate()'
collect2: error: ld returned 1 exit status
make: *** [mnisten] Error 1
/tmp/cc8jUmsH.o: In function `read_images(boost::filesystem::path const&, unsigned char, std::vector<image, std::allocator<image> >&, int, int)':
main.cpp:(.text+0x773): undefined reference to `cv::imread(cv::String const&, int)'
collect2: error: ld returned 1 exit status
make: *** [mnisten] Error 1

I face various type of error, the last error log is above.
I try for three method:

  1. Copy the whole include file under include folder
  2. Vertified the makefile as below:
g++ -Wall -O2   -std=c++0x -o mnisten src/main.cpp -lboost_system -lboost_filesystem -lopencv_calib3d  -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_highgui -lopencv_imgproc  -lopencv_ml  -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_imgcodecs

Cause the make command didn't have the opencv parameter.
The parameter of boost might be wrong.
(I didn't have the experience on boost, just share the solving method)
I collect lots of opencv parameter in it. Some lib isn't necessary.
I just show the command that I have been successful.
(My env. is Ubuntu 14.04 LTS, OpenCV 3.0.0)

@tmuruges
Copy link

@SunnerLi - How did you solve it.

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

2 participants