Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Apr 1 '13 at 11:25

This question came from our site for professional and enthusiast programmers.

    
Just putting this out there. I do know how to use make at a basic level; I'm just not very comfortable with it. –  Maz Apr 1 '13 at 20:07

3 Answers 3

up vote 0 down vote accepted

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

share|improve this answer
    
Thank you. I don't know how I missed that. –  Maz Apr 1 '13 at 20:09
    
If this is the answer You were looking for, please accept it. –  morynicz Apr 2 '13 at 9:26
    
Sorry. I'm new to this and didn't know how to accept. Thanks! –  Maz Apr 20 '13 at 7:32

Pointers: read g++ and make manuals and google for tutorials.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.