Ask Your Question

Plankalkuel's profile - activity

2020-08-23 08:35:16 -0600 received badge  Notable Question (source)
2017-09-29 07:12:48 -0600 received badge  Popular Question (source)
2016-04-17 17:56:20 -0600 received badge  Nice Answer (source)
2016-04-17 17:55:08 -0600 received badge  Student (source)
2015-09-13 08:32:41 -0600 commented answer Sudden linker error with GCC 5.2.0

My code: Yes. But I don't generally rebuild all libraries that I use when I switch to a new compiler version. And since this "error" is explicitly mentioned in the release notes I would expect that in general that is also not necessary.

2015-09-11 06:41:03 -0600 received badge  Teacher (source)
2015-09-10 06:09:01 -0600 received badge  Self-Learner (source)
2015-09-10 05:54:28 -0600 received badge  Editor (source)
2015-09-10 04:27:20 -0600 commented question Sudden linker error with GCC 5.2.0

I now solved the problem by building OpenCV 3.0 from source. I never had to rebuild a library because of switching to a newer version of gcc.

After reading a bit I assume the reason is that with GCC 5.2.0 a new ABI is activated by default.

From the GCC release notes:

If you get linker errors about undefined references to symbols that involve types in the std::__cxx11 namespace or the tag [abi:cxx11] then it probably indicates that you are trying to link together object files that were compiled with different values for the _GLIBCXX_USE_CXX11_ABI macro. This commonly happens when linking to a third-party library that was compiled with an older version of GCC. If the third-party library cannot be rebuilt with the new ABI then you will need to recompile your code with the old ABI.

Switching to the old ABI works like this:

The old ABI is still supported and can be used by defining the macro _GLIBCXX_USE_CXX11_ABI to 0 before including any C++ standard library headers.

So maybe that will be of help to someone else.

2015-09-10 00:46:42 -0600 asked a question Sudden linker error with GCC 5.2.0

I am using OpenCV 2.4 in a project and up to GCC 5.1.0 I had no problems with compiling.

Suddenly, after installing GCC 5.2.0 (from source) I get a linker error for some of the OpenCV functions. The majority seems to work. Only the cs::im* functions seem to cause problems.

CMakeFiles/2DSIL.dir/main.cpp.o: In function `main':
/home/c7031105/Dropbox/2DSIL/main.cpp:35: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/home/c7031105/Dropbox/2DSIL/main.cpp:110: undefined reference to `cv::imwrite(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&, std::vector<int, std::allocator<int> > const&)'
CMakeFiles/2DSIL.dir/V4.cpp.o: In function `V4::getWeights(std::vector<int, std::allocator<int> >, double&)':
/home/c7031105/Dropbox/2DSIL/V4.cpp:313: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/2DSIL.dir/V4.cpp.o: In function `V4::compare(std::vector<int, std::allocator<int> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/c7031105/Dropbox/2DSIL/V4.cpp:110: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/2DSIL.dir/V4.cpp.o: In function `V4::getWeights(cv::Mat, cv::Mat, double&)':
/home/c7031105/Dropbox/2DSIL/V4.cpp:352: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/home/c7031105/Dropbox/2DSIL/V4.cpp:379: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/2DSIL.dir/V4.cpp.o: In function `V4::compare(cv::Mat, cv::Mat, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/home/c7031105/Dropbox/2DSIL/V4.cpp:179: undefined reference to `cv::imread(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/2DSIL.dir/V4.cpp.o: In function `void cv::Mat::push_back<int>(int const&)':
/usr/local/include/opencv2/core/mat.hpp:689: undefined reference to `cv::Exception::Exception(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
CMakeFiles/2DSIL.dir/img_read_write.cpp.o: In function `dsil::visualize(cv::Mat const&, int)':
/home/c7031105/Dropbox/2DSIL/img_read_write.cpp:91: undefined reference to `cv::namedWindow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)'
/home/c7031105/Dropbox/2DSIL/img_read_write.cpp:92: undefined reference to `cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)'
CMakeFiles/2DSIL.dir/img_read_write.cpp.o: In function `dsil::imgwrite(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::Mat const&)':
/home/c7031105/Dropbox/2DSIL/img_read_write.cpp:49: undefined reference to `cv::imwrite(std ...
(more)