Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Eclipse on OSX EL OpenCV3

I successfully compiled and installed the 3.1.0-dev

pkg-config

$pkg-config --libs --cflags opencv
-I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core

main.cpp:

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"

using namespace std;
using namespace cv;

Mat src; Mat dst;
char window_name1[] = "Unprocessed Image";
char window_name2[] = "Processed Image";

int main( int argc, char** argv )
{
    /// Load the source image
    src = imread( argv[1], 1 );

    namedWindow( window_name1, WINDOW_AUTOSIZE );
    imshow("Unprocessed Image",src);

    dst = src.clone();
    GaussianBlur( src, dst, Size( 15, 15 ), 0, 0 );

    namedWindow( window_name2, WINDOW_AUTOSIZE );
    imshow("Processed Image",dst);

    waitKey();
    return 0;
}

I can compile and execute main.o by using very simple argument

g++ main.cpp `pkg-config --cflags --libs opencv` -o main.o
./main.o image.jpg

But when I put my include and libs directory to Eclipe

image description

image description

14:49:49 **** Incremental Build of configuration Debug for project aiyara ****
make all 
Building target: aiyara
Invoking: MacOS X C++ Linker
g++ -L/usr/local/lib -o "aiyara"  ./src/aiyara.o   -lopencv_core -lopencv_highgui -lopencv_imgproc
Undefined symbols for architecture x86_64:
  "cv::imread(cv::String const&, int)", referenced from:
      _main in aiyara.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [aiyara] Error 1

14:49:49 Build Finished (took 126ms)