Corda, S. via llvm-dev
2019-Oct-16 17:21 UTC
[llvm-dev] Opencv tutorial code compilation with clang
Hi all, I'm trying to compile the following code using clang++: https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp With g++ I don't have problem I just did: g++ Morphology_1.cpp -I /workspace/opencv/modules/core/include/ -I /workspace/opencv/modules/imgproc/include/ -I /workspace/opencv/modules/core/include/ -I /workspace/opencv/include/opencv2/ -I /workspace/opencv/build/ -I /workspace/opencv/modules/highgui/include/ -I /workspace/opencv/modules/imgcodecs/include/ -I /workspace/opencv/modules/videoio/include/ -L /workspace/opencv/build/lib/ -std=c++11 -o Morphology -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs cp ../../../data/LinuxLogo.jpg LinuxLogo.jpg sudo ldconfig -v Thanks, Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191016/32a52918/attachment.html>
Corda, S. via llvm-dev
2019-Oct-16 17:29 UTC
[llvm-dev] Opencv tutorial code compilation with clang
Hi all, I'm trying to compile the following code using clang++: https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/ImgProc/Morphology_1.cpp With g++ I don't have problem I just did: g++ Morphology_1.cpp -I /workspace/opencv/modules/core/include/ -I /workspace/opencv/modules/imgproc/include/ -I /workspace/opencv/modules/core/include/ -I /workspace/opencv/include/opencv2/ -I /workspace/opencv/build/ -I /workspace/opencv/modules/highgui/include/ -I /workspace/opencv/modules/imgcodecs/include/ -I /workspace/opencv/modules/videoio/include/ -L /workspace/opencv/build/lib/ -std=c++11 -o Morphology -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs cp ../../../data/LinuxLogo.jpg LinuxLogo.jpg sudo ldconfig -v Using the same compilation flags I got this error (clang++): /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/cstddef:51:11: error: no member named 'max_align_t' in the global namespace I added -stdlib=libc++, but I got: /tmp/Morphology_1-1e9ee6.o: In function `main': Morphology_1.cpp:(.text+0xe7): undefined reference to `cv::CommandLineParser::CommandLineParser(int, char const* const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)' Morphology_1.cpp:(.text+0x1cf): undefined reference to `cv::samples::findFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, bool)' Morphology_1.cpp:(.text+0x1ec): undefined reference to `cv::imread(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)' Morphology_1.cpp:(.text+0x4d4): undefined reference to `cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)' Morphology_1.cpp:(.text+0x58f): undefined reference to `cv::namedWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int)' Morphology_1.cpp:(.text+0x64d): undefined reference to `cv::moveWindow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, int)' Morphology_1.cpp:(.text+0x7bc): undefined reference to `cv::createTrackbar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int*, int, void (*)(int, void*), void*)' Morphology_1.cpp:(.text+0x93d): undefined reference to `cv::createTrackbar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int*, int, void (*)(int, void*), void*)' Morphology_1.cpp:(.text+0xab8): undefined reference to `cv::createTrackbar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int*, int, void (*)(int, void*), void*)' Morphology_1.cpp:(.text+0xbfd): undefined reference to `cv::createTrackbar(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int*, int, void (*)(int, void*), void*)' /tmp/Morphology_1-1e9ee6.o: In function `Erosion(int, void*)': Morphology_1.cpp:(.text+0x1069): undefined reference to `cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)' /tmp/Morphology_1-1e9ee6.o: In function `Dilation(int, void*)': Morphology_1.cpp:(.text+0x13c9): undefined reference to `cv::imshow(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, cv::_InputArray const&)' /tmp/Morphology_1-1e9ee6.o: In function `std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > cv::CommandLineParser::get<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) const': Morphology_1.cpp:(.text._ZNK2cv17CommandLineParser3getINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEET_RKS8_b[_ZNK2cv17CommandLineParser3getINSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEEET_RKS8_b]+0xf7): undefined reference to `cv::CommandLineParser::getByName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, cv::Param, void*) const' clang: error: linker command failed with exit code 1 (use -v to see invocation) Do you know how to fix this issue? Thanks, Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191016/e8b8b1cf/attachment.html>