报错
/usr/bin/ld: /tmp/ccKc0i2H.o: undefined reference to symbol '_ZNSaIcED1Ev@@GLIBCXX_3.4'
/usr/bin/ld: /lib/x86_64-linux-gnu/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
解决方法
问题在于使用的是gcc来进行编译
gcc main.cpp -o main $(pkg-config --cflags --libs opencv) -lOpenCL
修改为
g++ main.cpp -o main $(pkg-config --cflags --libs opencv) -lOpenCL
即可