Amelio Vazquez-Reina
Amelio Vazquez-Reina

Reputation: 96294

Inferring include paths and make targets from existing Makefile in Eclipse

I am trying to use Eclipse on an existing collection of folders with C++ and recursive Makefile files in Linux. The make files use gcc and ar, and the user specifies the path to the gcc he wants to use in the Makefile. The make files that I will be working with were typed by hand.

In Eclipse, there is an option to create a new project that looks appropriate for what I need: "Create a new Makefile project from existing code in that same directory".

* <none>
* cross GCC
* GNU Autotools Toolchain
* Linux GCC

Here I have two questions:

Upvotes: 6

Views: 2695

Answers (2)

bobestm
bobestm

Reputation: 1334

Your question is very similar to what I have setup for my project.

  1. If the target platform that the application is expected to run on is the machine you are compiling on, the you ought to select Linux GCC.
  2. If the target platform that application will run on is eg an ARM processor, you need to specify cross GCC.
  3. The GNU Autotools Toolchain is designed to build source-code packages on different linux systems.

By selecting "Create a new Makefile project from existing code in that same directory" eclipse will assume that the user's makefiles will manage the build itself. For eclipse to infer include paths, have the discovery options enabled in the project settings. Admittedly, your top-level make needs to specify include path, source-code paths etc.

Upvotes: 3

Jimmy Johnson
Jimmy Johnson

Reputation: 908

You really can only eiter allow Eclipse to create the makefile for you based on what you have in your project or tell it which command to run when you select 'build'. Mixing these options I have found doesn't really work. If you are specifying the Makefile then the compiler used doesn't really matter either since the Makefile will define that. Just pick an 'empty c++ project' when you create a new project, make sure you specify not to use the 'default workspace' location and point this input box to your code base instead. In the project c++/build settings make sure that the "automatically generate makefile" is unchecked and specify what command should be executed to make your project. (usually this is 'make all' but it might be different for you)

Upvotes: 1

Related Questions