Home GNU g++ return error while compiling opencv3 example having imwrite function
Reply: 0

GNU g++ return error while compiling opencv3 example having imwrite function

user1393
1#
user1393 Published in July 17, 2018, 7:54 am

I installed g++ using brew under Mac OS.

brew info gcc
gcc: stable 7.2.0 (bottled), HEAD
GNU compiler collection
https://gcc.gnu.org/
/usr/local/Cellar/gcc/7.2.0 (1,486 files, 289.8MB) *
  Poured from bottle on 2017-11-17 at 17:46:50
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/gcc.rb
==> Dependencies
Required: gmp ✔, libmpc ✔, mpfr ✔, isl ✔
==> Options
--with-jit
  Build just-in-time compiler
--with-nls
  Build with native language support (localization)
--HEAD
   Install HEAD version

When I compile a opencv example using this g++, It came out

Undefined symbols for architecture x86_64:
  "cv::imwrite(cv::String const&, cv::_InputArray const&, 
std::vector<int, std::allocator<int> > const&)", referenced from:
     _main in ccb1tZEa.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

But, when use native g++ shipped with Mac, it goes well.

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

What is the difference between these two compilers? And, how can I compile opencv project with GNU g++?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.305935 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO