Ubuntu 下搭建Opencv![2]
原文链接:http://stackoverflow.com/questions/10876627/cannot-run-brief-demo-on-linux
this line:
g++ `pkg-config opencv --libs` main.o BRIEF.o -o BRIEF_demo
should read:
g++ main.o BRIEF.o -o BRIEF_demo `pkg-config opencv --libs`
or, if you're editing the makefile:
$(EXECUTABLE): $(OBJECTS)
$(CC) $(OBJECTS) -o $@ $(LDFLAGS)
i.e. move the $(LDFLAGS)
to
the end of the line.
What's happening is that the linking to dependent libraries is skipped because at the time they are specified they are not actually needed. They are needed once the main.o and BRIEF.o files have been processed, so they will be linked in at that point.
It's a quirk of linking.