Search code examples
c++makefileeclipse-cdt

run makefile generated by eclipse from command line after updating code not working


I'm running

eclipse juno Service Release 2 Build id: 20130225-0426 with this CDT config

and this OS:

(truncated output of uname -a): Linux 3.2.0-51-generic #77-Ubuntu SMP x86_64 x86_64 x86_64 GNU/Linux

I create a HelloWorld C++ project as follows:

  • File->New->C++ Project
  • Project type: Executable Empty Project
  • Toolchains: Cross GCC
  • Configurations: Debug and Release checked

Then I create a C++ source file Main.cpp that contains hello world code.

I can then compile using the hammer icon. I choose to compile in Release mode. The program runs fine (inside eclipse or at the command line) and prints "hello". If I modify the code to print out "hello there", I can recompile with the hammer and the program still runs fine and prints out "hello there".

However, if I modify the code to print out "hello there you", go to the Release directory (/home/user/workspace/HelloWorld/Release) and type make, I get this message: make: Nothing to be done for 'Main.d'.

There is a file called makefile in the Release directory, but it's not behaving like a normal makefile. I would expect this makefile to be such that when there is a change in the code and you type make, the code gets actually recompiled. If I type make clean followed by make, the code gets recompiled but this is inefficient for larger projects.

Do you know why the makefile generated by eclipse is behaving this way ? Thanks very much.


Solution

  • try $make all, instead of $make it should work.