views:

190

answers:

2

Hello, i'm using Eclipse 3.6 for C/C++ for Linux. I need to compile existing project with my own working makefile. This makefile works well from the command line, but when I imported my project into Eclipse and try to use Build, it doesn't work, seems that it try to use makefile automatically created by Eclipse. I unchecked the switch "Generate Makefile automatically" in Project Properties - C/C++ Build, and instead of many errors got this: "* commands commence before first target. Stop."

May be this project was not imported correctly into Eclipse? I know there is such a thing as "Standard Make project" which will not create makefile automatically but needs my own makefile, but in Eclipse IDE (under File- New- C++ Project) there is no "Standard Make project" options available. So question is how to point Eclipse to the right makefile for building the imported project?

I also tried to switch off the "Use default build command" in Project Properties - C/C++ Build and put there in "Build command" line /path_to_project_folder/make, the result is (in Console): Cannot run program "/path_to_project_folder/make": Unknown reason" I would appreciate any suggestions.

A: 

So far the best way to deal with this situation which i found, is to substitute automatically generated by Eclipse makefile (which is stored in Debug directory, created by Eclipse in the project folder) with my own makefile, in which i just include this lines:

all: 
    cd .. && $(MAKE)

Now when i try to build the project from the Eclipse IDE (with the button) it executes that makefile, which does all the job, and the projects compiles normally.

lugger1
A: 

Don't import.

Instead, create a NEW project using the "Makefile Project from Existing Code" under C/C++.

Yes, it's somewhat counterintuitive, but it works.

Uncle Mikey