Undefined symbols for architecture x86_64:

Ryan Schmidt ryandesign at macports.org
Tue Sep 23 01:00:56 PDT 2014


On Sep 23, 2014, at 1:55 AM, Brickle Macho wrote:
> 
> Not sure how to solve my problem, any help appreciated   Writing a simple C++ program to use OpenCV 2.4.9.  I am getting the following error.
> 
> Undefined symbols for architecture x86_64:
>  "cv::imread(std::basic_string<.....
> 
> Google searches seems to indicate linker error and/or libs compiled with different C++ compilers.    Everything has been installed via Macports.  OpenCV appears to be configured/installed as per output below.   Problem seems to be with C++ code.  Python scripts seem to be able to use OpenCV stuff.  In this instance need to use C++.  Not sure where to start to solve this problems.   Any idea, how to diag/solve my issue.
> 
> Regards,
> 
> Michael.
> -----
> 
> 
> Now, I have done:
> 
> sudo port selfupdate
> sudo port upgrade outdate
> tried cmake (seemed to find OpenCV)
> tried hand crafted Makefile
> 
> /usr/local have been moved to /usr/local_mac
> 
> Output from "pkg-config --cflags opencv"
> -I/opt/local/include/opencv -I/opt/local/include
> 
> Output from "pkg-config --libs opencv"
> -L/opt/local/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab
> 
> Output from "port select gcc"
> Available versions for gcc:
>    mp-gcc45
>    mp-gcc47 (active)
>    mp-llvm-gcc42
>    none
> 
> gcc --version
> gcc (MacPorts gcc47 4.7.4_1) 4.7.4
> Copyright (C) 2012 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> 
> g++ --version
> g++ (MacPorts gcc47 4.7.4_1) 4.7.4
> Copyright (C) 2012 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You must must clang, not gcc.

https://trac.macports.org/wiki/FAQ#libcpp




More information about the macports-users mailing list