Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to modify some C++ files in ns2 and then recompile using make command. Although new .o file is created after make, the output is similar to that of previous C++ file (before modifying). Can someone suggest what may be the reason behind it?

share|improve this question
What sort of changes were you making? A make file is only as good as the dependencies it encodes. So for example if you were making changes to inlined functions in a header and the files that included it weren't recompiled, then that might explain what you're seeing. – James Henstridge Apr 8 '11 at 1:35
Try using: make clean before make. This removes the old .o files and creates new ones. So you completely recompile it. – omnidan Apr 10 '11 at 16:07

Are you modifying .cpp (or .C .cc etc.) files or header files? Some Makefiles are written very poorly and don't have decent dependency information (gcc -MMD or makedepend). This means the project is not rebuild correctly if you modify some files (often header files). You can check what files are triggered by modification (and why) with the command:

make --debug=b -n
share|improve this answer

Your Answer


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