I installed g++ using brew under Mac OS.
brew info gcc
gcc: stable 7.2.0 (bottled), HEAD
GNU compiler collection
/usr/local/Cellar/gcc/7.2.0 (1,486 files, 289.8MB) *
Poured from bottle on 2017-11-17 at 17:46:50
Required: gmp ✔, libmpc ✔, mpfr ✔, isl ✔
Build just-in-time compiler
Build with native language support (localization)
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)
Thread model: posix
What is the difference between these two compilers? And, how can I compile opencv project with GNU g++?