开发者

Makefile for Eclipse C/C++ in Linux

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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜