mac系统怎么编opencv_在64位mac上编译OpenCV代码

bd96500e110b49cbb3cd949968f18be7.png

I recently inherited some OpenCV code. I installed openCV on my mac, built in in XCode, and then compiled and successfully ran my first openCV "hello world"-ish program.

Now I'm trying to run the code I was given, but I get errors that lead me to believe it's an issue with the original code being run on a 32-bit Windows system and mine being on a 64-bit Mac.

When I run the Makefile by entering "make"

CC = g++

CFLAGS =

LDFLAGS = -I/usr/local/include/opencv -lm -lopencv_core -lopencv_highgui -lopencv_video

ALL = vision

all: $(ALL)

vision: vision.o

$(CC) $(LDFLAGS) -o $@ $^

vision.o: vision.cpp

$(CC) $(LDFLAGS) -c $<

.PHONY: clean

clean:

rm -rf *.o core* $(ALL)

I get the following output…

g++ -I/usr/local/include/opencv -lm -lopencv_core -lopencv_highgui -lopencv_video -o vision vision.o

Undefined symbols for architecture x86_64:

"cv::equalizeHist(cv::Mat const&, cv::Mat&)", referenced from:

_main in vision.o

"cv::threshold(cv::Mat const&, cv::Mat&, double, double, int)", referenced from:

_main in vision.o

ld: symbol(s) not found for architecture x86_64

collect2: ld returned 1 exit status

make: *** [vision] Error 1

I'm confused; does this mean my install of OpenCV is wrong, the code (those methods specifically) needs to be changed, or something else entirely?

Note: When I comment out the problem methods from the vision.cpp code, everything compiles just fine.

解决方案

Add opencv_imgprocto your LDFLAGS:

LDFLAGS = -I/usr/local/include/opencv -lm -lopencv_core -lopencv_highgui -lopencv_video -lopencv_imgproc

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值