0

I need to run a C++ program using OpenCV on a BeagleBoard running Angstrom. I know how to do this with an IDE (The program itself is ready), but I don't know how to compile it without one. I realize that I need to make a Makefile, but I'm not too familiar with Make.

Can anybody give me some pointers?

Narwhal
  • 103

2 Answers2

0

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...

morynicz
  • 116
0

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.

user
  • 30,336