OpenCV ohne IDE verwenden

1910
Maz

Ich muss ein C ++ - Programm mit OpenCV auf einem BeagleBoard ausführen, auf dem Angström ausgeführt wird. Ich weiß, wie man dies mit einer IDE macht (das Programm selbst ist fertig), aber ich kann es nicht ohne IDE kompilieren. Mir ist klar, dass ich ein Makefile erstellen muss, aber ich bin mit Make nicht so vertraut.

Kann mir jemand Hinweise geben?

0
Einfach das rausbringen. Ich weiß, wie man make auf einer grundlegenden Ebene verwendet. Ich fühle mich einfach nicht sehr wohl damit. Maz vor 11 Jahren 0

2 Antworten auf die Frage

0
morynicz

Here is a tutorial about using OpenCV with CMake. It will generate makefile for You. On the other hand, just as Billy L said, You should look for a make tutorial, because without this kind of knowledge You will be somewhat disabled as a programmer...

0
a CVn

In its simplest form, a makefile is pretty much just a list of commands, separated by labels. By convention, the label all is usually used as a sort of default.

The makefile consists of:

label1: [dep1 ... depN] <tab> command1 <tab> command2  label2: [dep1 ... depN] <tab> command1 <tab> command2  ... 

A traditional beginner's mistake is to indent using spaces, but make wants commands to be indented using a single tab character.

For a simple case, you can ignore the dependencies.

So, the simplest makefile will be something along the lines of:

all: <tab> cc -o hello -Wall hello.c 

Invoking make in a directory where a file like the above exists as Makefile will cause cc -o hello -Wall hello.c to be invoked. If your make is really picky, you may need to explicitly say make all, but that should not be necessary.

There's about a million possibilities with makefiles, but the above should get you started. Strictly speaking the above examples are for GNU make, but makefiles are so ubiquous I don't see other implementations doing the basic use case very differently.